✓ PASS
pydantic-ai 2.61.0
usage.cached-tokens · anthropic
Requirements
| Id | Level | Status | Evidence |
|---|---|---|---|
| total-reconciles | MUST | SATISFIED | usage.total=1557 (primary); truth.usage.total=1557 |
| cached-input-reported | SHOULD | SATISFIED | usage.cached_input=1536 (primary); truth.usage.cached_input=1536 |
What the provider sent
- Finish
- stop
- Raw finish
- end_turn
- Text
- A hot pan helps moisture evaporate so mushrooms brown.
- Tool calls
[]
- Usage
{ "alternatives": { "input": { "uncached_input": 0 } }, "cached_input": 1536, "input": 1536, "output": 21, "raw": { "cache_creation_input_tokens": 0, "cache_read_input_tokens": 1536, "input_tokens": 0, "output_tokens": 21 }, "reasoning": null, "total": 1557 }- Stream completed
null
- Error
null
Wire excerpt
status: 200
content-type: application/json
body (json):
{
"id": "msg_01Aq9w938a90dw8q",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "A hot pan helps moisture evaporate so mushrooms brown."
}
],
"model": "claude-sonnet-5-5",
"stop_reason": "end_turn",
"stop_sequence": null,
"stop_details": null,
"usage": {
"input_tokens": 0,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 1536,
"output_tokens": 21
}
}What the library reported
- Outcome
- returned
- Finish
{ "raw": "end_turn", "source": "ModelResponse.finish_reason", "surface": "primary", "value": "stop" }- Text
- Value
- A hot pan helps moisture evaporate so mushrooms brown.
- Surface
- primary
- Tool calls
[]
- Usage
{ "cached_input": 1536, "input": 1536, "output": 21, "reasoning": 0, "surface": { "cached_input": "primary", "input": "primary", "output": "primary", "reasoning": "primary", "total": "primary" }, "total": 1557 }- Stream
{ "chunks_seen": null, "completed": null, "used": false }- Error
null
- Unsupported reason
null
Full observation JSON
{
"elapsed_ms": 222.95150067657232,
"error": null,
"finish": {
"raw": "end_turn",
"source": "ModelResponse.finish_reason",
"surface": "primary",
"value": "stop"
},
"format": "wiretruth.observation/v1",
"library": {
"api": "Agent.run",
"language": "python",
"name": "pydantic-ai",
"version": "2.61.0"
},
"notes": [],
"outcome": "returned",
"stream": {
"chunks_seen": null,
"completed": null,
"used": false
},
"structured": {
"attempted": false,
"returned_as_success": false,
"value": null
},
"text": {
"surface": "primary",
"value": "A hot pan helps moisture evaporate so mushrooms brown."
},
"tool_calls": [],
"unsupported_reason": null,
"usage": {
"cached_input": 1536,
"input": 1536,
"output": 21,
"reasoning": 0,
"surface": {
"cached_input": "primary",
"input": "primary",
"output": "primary",
"reasoning": "primary",
"total": "primary"
},
"total": 1557
}
}Fixture
documented anthropic/usage.cached-tokens
| Provenance | Value |
|---|---|
| Source | https://platform.claude.com/docs/en/build-with-claude/prompt-caching#tracking-cache-performance |
| Notes | Documented shapes, not a recording. Message envelope and stop fields follow handling-stop-reasons; content blocks follow thinking/streaming and handle-tool-calls. Model changed to claude-sonnet-5-5; IDs and scenario text are filled in. Token counts are illustrative, filled in to include thinking within the requested output limit, not measured. Cache field names and accounting are taken verbatim from Tracking cache performance. The original 916-word cooking guide exceeds the documented Sonnet 5.5 minimum of 512 tokens. ASSUMED warm cache covering the repeated request: input_tokens 0, cache_creation_input_tokens 0, cache_read_input_tokens 1536, output_tokens 21. Exact tokenization and this complete response are not documented. No request was sent twice; adaptive thinking is assumed skipped. |
Reproduce
wiretruth serve anthropic/usage.cached-tokensPlain-library snippet from the shim manifest.
AnthropicModel(model, provider=AnthropicProvider(base_url=WIRETRUTH_BASE_URL_ANTHROPIC, api_key=WIRETRUTH_API_KEY)); host rootUpstream
No matching upstream report.
History
| Version | Grade |
|---|---|
| 2.61.0 | ✓ PASS |
| 2.56.0 | ✓ PASS |