Skip to main content

Module provider

Module provider 

Source
Expand description

Provider-keyed usage normalizers. Each turns a provider’s raw usage object into token buckets. The agent dialects and the obol house dialect share these so the per-provider accounting — the cache-bucket split, the OpenAI cached-subtraction, the part naive summers get wrong — lives in one place, not once per dialect.

Modules§

anthropic
Anthropic usage object -> ProviderTokens. Shared by claude.rs (Claude Code embeds this object near-verbatim) and the obol house dialect.
openai
OpenAI Responses-API usage object -> ProviderTokens. input_tokens is a total that still includes cached tokens, so the uncached bucket is the difference — the cached-subtraction a producer must never do itself.

Structs§

ProviderTokens
Token buckets extracted from a provider usage object. Model, provider, namespace and service_tier are the caller’s to attach; request_input_tokens is derived from these by the caller.