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
| Level | Id | Check | Requirement | Providers |
|---|---|---|---|---|
| MUST | usage-reported | usage_matches_truth | Token usage is reported and matches the provider's counts. | All |
Fixtures
| Provider | Tier | any-llm | litellm | pydantic-ai | tanstack-ai | vercel-ai |
|---|---|---|---|---|---|---|
| anthropic | documented | ✓ PASS | ✓ PASS | ✓ PASS | ✓ PASS | ✓ PASS |
| gemini | recorded | ✓ PASS | ✓ PASS | ✓ PASS | ✓ PASS | ✓ PASS |
| ollama | recorded | ✓ PASS | ✓ PASS | – UNSUPPORTED | ✓ PASS | – UNSUPPORTED |
| ollama-openai | recorded | ✓ PASS | ✓ PASS | ✓ PASS | ✓ PASS | ✓ PASS |
| openai-chat | recorded | ✓ PASS | ✓ PASS | ✓ PASS | ✓ PASS | ✓ PASS |