Results / usage.stream-final-chunk

Streamed usage in a final chunk with no choices

The model finishes a short streamed answer, then reports usage in a chunk with no choices.

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
MUSTusage-reportedusage_matches_truthToken usage is reported and matches the provider's counts.All

Fixtures

ProviderTierany-llmlitellmpydantic-aitanstack-aivercel-ai
anthropicdocumented✓ PASS✓ PASS✓ PASS✓ PASS✓ PASS
geminirecorded✓ PASS✓ PASS✓ PASS✓ PASS✓ PASS
ollamarecorded✓ PASS✓ PASS– UNSUPPORTED✓ PASS– UNSUPPORTED
ollama-openairecorded✓ PASS✓ PASS✓ PASS✓ PASS✓ PASS
openai-chatrecorded✓ PASS✓ PASS✓ PASS✓ PASS✓ PASS