How token counts are captured
Token counts arrive from provider responses via OpenTelemetry attributes:gen_ai.usage.input_tokens(input tokens)gen_ai.usage.output_tokens(output tokens)gen_ai.usage.total_tokens(sum, computed by Orq.ai)
input_tokens_details.cached_tokens(tokens read from the prompt cache)input_tokens_details.cache_creation_tokens(tokens written to the prompt cache), with an Anthropic-only split intocache_creation_5m_tokensandcache_creation_1h_tokensby cache TTLoutput_tokens_details.reasoning_tokens(reasoning/thinking tokens)- Audio input and output tokens
How cost is calculated
Cost is computed per span server-side. The AI Gateway multiplies token counts by the model’s per-token rate:Cost categories
Pricing tiers
Some providers charge different rates based on context length. Orq.ai applies the correct rate automatically:
The active tier is recorded as
orq.billing.pricing_tier on each span.
Billable flag
orq.billing.billable is false for cached responses and automated evaluations run by the platform. These do not count toward workspace usage billing.
Cost rollup
Cost rolls up through the data model:Where to see cost breakdowns
Related pages
- Span Attributes: full reference of
orq.billing.*attributes - Billing and Usage: platform billing (seats, storage, plan capacity), separate from LLM cost tracking
- Budgets: set cost and token limits per scope