Locus product guide · Updated
LLM cost per user: how to track AI cost by customer
To track LLM cost per user, tag every model and tool call with your customer's ID, record the token counts or charge each call returns, and price them at your provider's rates. Then compare each customer's monthly cost with what they pay. On Claude Sonnet 5.5, at $2 per million input tokens and $10 per million output tokens, 300 requests of 5,000 input and 500 output tokens cost $4.50 a month.
What makes up the AI cost of one user?
Model tokens are only part of it. Count every paid step a user's request sets off. Prices checked November 10, 2026.
- Input and output tokens, priced separately. Output usually costs more: Claude Sonnet 5.5 is $2 in and $10 out per million tokens.
- Cached input. A cache hit on Sonnet 5.5 costs $0.10 per million tokens, but writing to the cache costs more than plain input.
- Built-in tools. Web search on the Claude API costs $10 per 1,000 searches, plus the tokens the results add.
- Paid APIs your agent calls, such as search, scraping or enrichment.
- Retries and failed runs, which use tokens without producing anything the user sees.
How do I attribute each call to a customer?
Pick one ID per paying account and send it on every call. Tools differ in how they capture it.
Observability tools estimate cost from token counts and a price table. Langfuse notes it cannot infer cost for reasoning models without token counts, and that price changes apply only to new data. A billing ledger records what was actually charged.
| Tool | How you tag the user | What it records |
|---|---|---|
| Langfuse | A user ID on each trace | Usage and cost per call, inferred from model prices or sent by you; its Metrics API filters by user |
| Helicone | A Helicone-User-Id header on requests through its gateway | Requests and usage per user, with custom properties such as plan tier |
| Locus Pro | The X-Locus-End-User header, or a customerId in X-Locus-Attribution | The actual charge per call in a ledger, grouped by customer in analytics |
| Your own logs | Your user ID stored next to the provider usage fields | Whatever you store, priced from a table you maintain |
What do light, typical and heavy users cost?
Assume each request sends 5,000 input tokens and gets 500 output tokens back from Claude Sonnet 5.5. Some requests also use web search on the Claude API, at $10 per 1,000 searches. The plan price is $20 a month.
Averages hide the heavy user. If 1 user in 10 is heavy and the rest are typical, the average cost is $8.19 and looks fine, while one account loses money every month.
| User | Requests and searches a month | Model cost | Search cost | Total cost | Margin on $20 |
|---|---|---|---|---|---|
| Light | 60 requests, 10 searches | $0.90 | $0.10 | $1.00 | $19.00 (95%) |
| Typical | 300 requests, 60 searches | $4.50 | $0.60 | $5.10 | $14.90 (75%) |
| Heavy | 2,000 requests, 600 searches | $30.00 | $6.00 | $36.00 | Loss of $16.00 |
How do I keep margin on heavy users?
Combine a cheaper path for routine work with limits customers can see.
- Route simple requests to a cheaper model. On Claude Haiku 5.5, at $0.10 and $0.50 per million tokens, the heavy user above costs $1.50 in model fees instead of $30.
- Cache repeated context, and send work that can wait to a batch API. Anthropic and OpenAI both price batch work at half the standard rate.
- Set a monthly budget per user, and show it in the product before it runs out.
- Include an allowance in the plan and bill usage above it.
- Charge paid tool calls at cost plus a markup instead of folding them into the plan price.
How do I track cost per customer with Locus Pro?
On a Locus Pro Enterprise workspace, each paid call can name the customer with X-Locus-End-User. Every response returns the charge and an API call ID, and calls made with a secret key also return the base cost. Model calls through the OpenAI-compatible endpoint report input, output and reasoning tokens when the provider sends them.
The ledger can be filtered by customer, provider and endpoint, and customer analytics lists each customer with their spend. That gives you cost per customer from what was charged, not from an estimate.
You can cap each customer with a policy: a budget per hour, day, week or month, a maximum charge per call, and allowed or blocked models. Locus Pro sees only calls made through it. Calls you send straight to a provider need an observability tool or your own logs.
Which way of tracking AI cost should I use?
Use the charged amounts when you bill; use estimates only to explore.
- You need traces, prompts and quality data along with cost: an observability tool such as Langfuse or Helicone.
- You bill customers for the usage: take the amounts from your billing records, not from estimates.
- Your agents call paid third-party APIs for customers: Locus Pro records and bills each call per customer.
- You call providers directly at low volume: log the provider usage fields with your user ID and keep your own price table.
Frequently asked questions
How do I calculate the LLM cost of a single request?
Multiply input tokens by the input price and output tokens by the output price, then add cached tokens and tool fees. For 5,000 input and 500 output tokens on Claude Sonnet 5.5, that is $0.01 plus $0.005, or $0.015.
Why does my cost estimate differ from my provider bill?
Estimates miss things: cached or reasoning tokens counted in the wrong bucket, tool fees, retries, and price changes after the data was logged. Langfuse, for example, warns that overlapping usage buckets double count cost. Check estimates against the provider invoice.
How often should I review cost per customer?
Weekly while you launch, then monthly. Look at the customers with the highest cost, not the average, and check each against their plan price.
Does Locus Pro track model costs as well as API costs?
Yes, for models called through Locus Pro. Model calls are paid from the same credits. Locus holds an amount based on the prompt and max_tokens, then settles from the usage the provider reports.
Implementation references
Use these first-party references for current request contracts and account requirements. Tool availability, prices, and negotiated terms can change.
Sources
Third-party details were checked on November 10, 2026. Vendors change pricing and features often, so confirm on their site before you decide.