OpenAI and Anthropic count cached tokens in opposite ways
11/30/2026 — 11/30, 17:22·1 sources (all)·1 reports (all)
Key takeaways
- A technical analysis compares how OpenAI and Anthropic report cached tokens for the same 2,048-token prompt with a cache hit. OpenAI returns…
Background & analysis
On November 30, 2026, a DEV Community post examined how OpenAI and Anthropic report cached tokens in their API usage objects, finding that the two companies take opposite approaches. The author sent the same 2,048-token prompt to both providers, with most of it served from the prompt cache, and compared the usage data returned. OpenAI reported prompt_tokens = 2048, with prompt_tokens_details.cached_tokens = 1792. Anthropic reported input_tokens = 256, with cache_read_input_tokens = 1792. Same prompt, same cache hit, yet the headline input figures differed by a factor of eight.
According to the post, neither provider is wrong. They simply record cached tokens in different places: OpenAI counts cached tokens inside prompt_tokens, while Anthropic lists cache reads separately and lets input_tokens reflect only the uncached portion. To help developers reconcile the two, the author provided a small function that converts both usage formats into a single structure, and also listed the most common billing and usage-tracking mistakes. As of that report, the matter remained a developer-level explanation of the differing conventions and a conversion method; the material contains no official response from either company.
AI-generated from 1 reports · updated 5 days ago
- Heat index
- 25
- All sources
- 1
- All reports
- 1
- First seen
- 5 days ago
Reports on this story headlines open the original
Send the same 2,048-token prompt with the same cache hit to both providers and the headline input counts differ 8x: OpenAI reports prompt_tokens = 2048 with 1792 cached, Anthropic reports input_tokens = 256 with 1792 cache reads. The post shows where each vendor records cached tokens, offers a small function that normalizes both, and lists the billing and usage-tracking mistakes that follow from reading a single field.
DEV Community · AIAI score 64
Other stories people are talking about
- Heat index 167EU plans formal probe into OpenAI and Anthropic this month3 sources
- Heat index 55Former researcher says OpenAI and Anthropic architectures are close to Kimi1 sources
- Heat index 234SurgeAnthropic and OpenAI discuss joint limits for frontier models3 sources
- Heat index 65Security review finds Anthropic and OpenAI models vulnerable to state hackers1 sources
- Heat index 44Anthropic plans AI lab in India with government partners1 sources
How is heat calculated?About the methodHide
Heat counts how many independent sources covered a story in the last 48 hours: one source counts once no matter how many posts it published, decaying with a 24-hour half-life. What ranks first is what many people are talking about.
This page aggregates public feeds. Headlines and summaries are machine-organized and remain the property of the original authors; verify important facts at the source. If you believe a headline or summary infringes your rights, email the contact address in the footer with the page URL and basis of your claim, and we will remove or replace it after review.
- Surge
- Discussion rising fast
- New
- First report within 6 hours
- Rising
- Still gathering discussion

