LLM Cost Tracking by Customer, Feature, and Model
LLM cost tracking attributes every model charge to the user, customer, feature, agent, or workflow that created it. Bear Lumen reads token and usage metadata from provider responses, applies the relevant rate card, and records the resulting cost in near real time, without proxying your traffic or storing prompt content.
What LLM cost tracking measures
Every model call has a cost you can compute exactly from the response: the input tokens, the output tokens, and the per-token rate for that specific model. LLM cost tracking captures that cost for each request and attaches it to the dimensions you care about, such as the end user, the customer account, the feature, the agent, or the workflow.
The result is a cost you can slice any way you run your business. Cost per customer tells you who is expensive to serve. Cost per feature tells you which parts of the product are worth their spend. Cost per model tells you where a cheaper model would do the same job.
Request cost = (input_tokens × input_rate) + (output_tokens × output_rate)A GPT-class call with 3,000 input tokens and 800 output tokens, billed at $0.01 and $0.03 per 1K tokens, costs (3 × $0.01) + (0.8 × $0.03) = $0.054. Attribute that to the customer whose request triggered it and it becomes part of their cost to serve.
Why the provider invoice is not enough
A monthly bill from OpenAI or Anthropic tells you the total, not who drove it. It cannot tell you that one power user consumed 40 percent of your model spend, that a single feature quietly doubled in cost after a prompt change, or that a customer paying $200 a month costs you $260 to serve.
Those answers live one level down, at the request. Without per-request attribution you are averaging across every customer, which hides the accounts that are losing you money and the features that are carrying the rest.
How to track LLM cost with Bear Lumen
You send Bear Lumen the raw provider response, or the token counts, along with any attribution you want (a user ID, a feature name, an agent, a tenant). The SDK auto-detects the provider, extracts the token usage, applies the current rate for that model, and records the cost. There is no proxy in your request path and prompt content is never stored, so there is no added latency and no new data-handling risk.
From there the cost flows into cost, attribution, and margin views: cost by customer, cost by model, and margin against the revenue each customer generates.
- Providers covered: OpenAI, Anthropic, Amazon Bedrock, Google Gemini, Mistral, and Ollama.
- Attribution dimensions: end user, customer, feature, agent, workflow, and any custom metadata key.
- No proxy, no prompt storage, near real-time cost.