Results / usage.reasoning-tokens

Token usage accounts for thinking and answer tokens

Token usage includes reasoning and answer tokens, with provider-specific output accounting.

Bug class: Token usage misreported

The library reports token counts that differ from the provider's: cached or reasoning tokens are dropped or double-counted, or streamed usage is lost.

Cost and quota tracking is off, most often on cached prompts and reasoning models.

Requirements

LevelIdCheckRequirementProviders
MUSTtotal-reconcilesusage_total_reconcilesTotal usage agrees with the provider, including thinking tokens.All
SHOULDreasoning-reportedusage_matches_truthThe separately reported thinking token count is exposed.All

Fixtures

ProviderTierany-llmlitellmpydantic-aitanstack-aivercel-ai
anthropicdocumented✓ PASS✓ PASS✓ PASS– UNSUPPORTED✓ PASS
geminirecorded✓ PASS✓ PASS✓ PASS– UNSUPPORTED✓ PASS
openai-chatrecorded✓ PASS✓ PASS✓ PASS– UNSUPPORTED✓ PASS
openai-responsesrecorded✓ PASS✓ PASS✓ PASS– UNSUPPORTED✓ PASS