ai-cost-per-user
LLM spend attribution for multi-tenant SaaS
Track LLM token costs per user and tenant before one customer drains your margin.
ai-cost-per-user sits between your app and LLM providers, logs every call with user attribution, and shows exactly who is burning API budget. Set hard limits, justify overages, and keep gross margin predictable.
Why teams buy this
Multi-tenant AI products need spend attribution as early as they need usage analytics.
Identify the exact users and tenants driving 80% of token spend.
Prevent one enterprise tenant from silently consuming shared model budget.
Back your overage billing with per-request cost evidence.
The Problem
LLM bills arrive aggregated, not attributed.
The Solution
Proxy + tracking middleware with tenant context.
The Result
Usage economics become manageable.
Integration Snapshot
Drop-in proxy pattern for your backend.
await fetch("https://your-domain.com/api/proxy/openai/v1/chat/completions", {
method: "POST",
headers: {
"content-type": "application/json",
"x-user-id": appUser.id,
"x-tenant-id": appUser.tenantId
},
body: JSON.stringify({
model: "gpt-4.1-mini",
messages: [{ role: "user", content: "Summarize this account activity" }]
})
});What the dashboard reveals
Not just totals. Actionable attribution.
Daily token spend trend by tenant and user cohort.
Highest-cost users with per-call averages and last activity.
Recent requests for rapid debugging of cost spikes.
Simple Pricing
One plan for SaaS teams that need immediate cost attribution and budgeting visibility.
FAQ
How does user attribution work?
Add `x-user-id` and `x-tenant-id` headers (or body fields) to each proxied request. The middleware captures those values with usage and cost metadata.
How does checkout unlock the dashboard?
Point your Stripe Payment Link success URL to `/purchase/success?session_id={CHECKOUT_SESSION_ID}`. The app validates that session from webhook events and sets an access cookie.
Can I use this for overage billing evidence?
Yes. Each request log includes user, tenant, model, token totals, estimated cost, and timestamp so you can support invoice line-items with traceable usage.