Claude and TOON: Maximizing Efficiency in AI Agentic Tasks
Claude and TOON: cut token costs for agentic workflows, updated for Opus 5.5, Sonnet 5.5 and Haiku 4.5 pricing (October 2026).
Update (October 2026)
This post was first published in December 2025, when Claude 3.5 Sonnet and Claude 3.5 Haiku were Anthropic's headline models. Both are now retired on the Claude API (Haiku 3.5 remains only on Amazon Bedrock and Google Cloud). We rewrote the examples and cost math for the current lineup: Claude Fable 5.1, Opus 5.5, Sonnet 5.5 and Haiku 4.5. Benchmark figures now come from the current official TOON run (5,856 LLM calls). For the API integration pattern, see Using TOON with Claude.
TOON cuts the cost of feeding structured data to Claude by removing repeated JSON keys, braces and quotes. In the current official benchmark, TOON used 42.6% fewer tokens than JSON at equal or slightly better accuracy. With Claude agentic workflows sending large tool results on every turn, that reduction applies directly to your input bill on Sonnet 5.5, Opus 5.5 and Haiku 4.5.
Which Claude models are current in October 2026?
The original version of this article covered Claude 3.5 Sonnet's jump on SWE-bench Verified and the then-new Claude 3.5 Haiku. Those models have since been replaced. As of October 2026, Anthropic's model overview and pricing page list the following models (prices per million tokens, standard tier):
| Model | Input | Output | Cache read |
|---|---|---|---|
| Claude Fable 5.1 | $10 | $50 | $0.25 (0.025x) |
| Claude Opus 5.5 | $4 | $20 | $0.20 (0.05x) |
| Claude Sonnet 5.5 | $2 | $10 | $0.20 (0.1x) |
| Claude Haiku 4.5 | $1 | $5 | $0.10 (0.1x) |
| Claude Haiku 3.5 (retired on the Claude API) | $0.80 | $4 | Bedrock and Google Cloud only |
Two changes matter for data-heavy prompts. First, per-token prices dropped: Sonnet 5.5 costs $2 per million input tokens, compared with $3 for Claude 3.5 Sonnet. Second, Anthropic says Claude 4.7 and later models use a newer tokenizer that "produces approximately 30% more tokens for the same text." The same JSON payload can therefore produce more billed tokens on Sonnet 5.5 than it did on Claude 3.5 Sonnet, which makes trimming the payload more valuable, not less.
Why does JSON waste tokens in Claude prompts?
Developers feed Claude product catalogs, database rows, API responses and tool results, and most of that data arrives as JSON. JSON repeats every key on every record and adds quotes, braces and commas around each value. Those characters carry no new information once the model has seen the first record.
Consider a coding agent that receives a list of API endpoints from a tool. Here is a three-item sample in JSON and the same data as TOON, generated with @toon-format/toon 4.1.1:
[
{
"name": "createUser",
"method": "POST",
"path": "/users",
"returns": "User"
},
{
"name": "deleteUser",
"method": "DELETE",
"path": "/users/{id}",
"returns": "boolean"
},
{
"name": "updateUser",
"method": "PATCH",
"path": "/users/{id}",
"returns": "User"
}
]endpoints[3]{name,method,path,returns}:
createUser,POST,/users,User
deleteUser,DELETE,"/users/{id}",boolean
updateUser,PATCH,"/users/{id}",UserTOON declares the field names once in the header, states the row count ([3]), and lists only values. Values that contain structural characters, such as the braces in /users/{id}, are quoted. With 100 endpoints instead of three, JSON would repeat "name", "method", "path" and "returns" 100 times each; TOON still writes them once.
How much does TOON save, and is Claude as accurate with it?
The current official TOON benchmark (v4.1) ran 5,856 LLM calls: 244 questions across six formats and four models. TOON scored 72.2% accuracy versus 71.4% for JSON while using 42.6% fewer tokens. On flat, uniform datasets the reduction versus JSON was 58.7%; on mixed-structure datasets it was 32.7%.
The Claude model in that run is Claude Haiku 4.5 (claude-haiku-4-5-20251001). It scored 65.6% on TOON versus 63.5% on JSON. That gap is inside the benchmark's confidence intervals, so the safe reading is "no accuracy loss at a much lower token count." Opus 5.5, Sonnet 5.5 and Fable 5.1 were not tested, so measure on your own questions before switching a production pipeline. For the full breakdown, see our TOON benchmarks analysis.
How do you use TOON for Claude tool results?
Claude agentic workflows pass tool results back into the context on every turn, so their size compounds across a session. Suppose an e-commerce assistant answers "Show me wireless headphones under $400" by calling a searchProducts tool. Returning the results as TOON keeps the tool result compact:
Tool response in TOON
products[4]{id,name,price,rating,inStock}:
p1,Sony WH-1000XM5,299.99,4.8,true
p2,Bose QuietComfort 45,279.95,4.7,true
p3,Apple AirPods Max,549,4.6,false
p4,Sennheiser Momentum 4,349.95,4.9,trueNote that TOON writes numbers in canonical form, so 549.00 becomes 549. Keep the tool's input schema and any structured output Claude generates in JSON: Claude structured outputs are generally available and work with JSON Schema. TOON belongs on the input side. For multi-turn agent patterns, see TOON for AI agents.
Where does TONL fit?
For applications that need schema validation, queries and streaming, TONL (Token-Optimized Notation Language) is an alternative. It offers schema validation, a query API for filtering data before it reaches Claude, streaming for large datasets, and 32–45% token reduction versus JSON. It is a good fit for multi-agent systems, RAG pipelines and database-backed applications that pass records to Claude frequently.
What does TOON save on a real Claude workload?
Here is the original cost scenario, recalculated with Claude Sonnet 5.5 prices as of October 2026. We assume TOON removes 40% of the structured-data tokens, close to the benchmark's 42.6% average. Your actual reduction depends on how uniform your data is.
Scenario: daily coding assistant usage
- • 1,000 users making requests daily
- • Average 20 requests per user per day
- • Each request includes 5,000 tokens of structured data (JSON, counted with the Sonnet 5.5 tokenizer)
- • Claude Sonnet 5.5 input price: $2.00/MTok
With JSON:
1,000 users × 20 requests × 5,000 tokens = 100M tokens/day
100M tokens × $2.00/MTok = $200/day
With TOON (40% reduction):
1,000 users × 20 requests × 3,000 tokens = 60M tokens/day
60M tokens × $2.00/MTok = $120/day
Savings: $80/day, about $2,400 per 30-day month, $29,200 per year
On Haiku 4.5 ($1/MTok) the same workload costs $100 per day with JSON and $60 with TOON. On Opus 5.5 ($4/MTok) it is $400 versus $240. If the structured data is reused across calls, prompt caching stacks on top: cache reads cost 10% of the input price on Sonnet 5.5 and Haiku 4.5, and 5% on Opus 5.5. See TOON and prompt caching for the combined math.
How do you get started with TOON and Claude?
- Audit your data payloads: Find where you send large JSON structures to Claude. Arrays of objects with the same fields benefit most; deeply nested or irregular data benefits least.
- Convert to TOON: Use our JSON to TOON converter to compare token counts, or the
@toon-format/toonnpm package in code. - Add a one-line format note: Tell Claude the data is TOON, that the header declares field names and row count, and that rows are comma-separated values.
- Measure: Count tokens with Anthropic's token-counting endpoint and check answer accuracy on a sample of real questions before rollout.
Frequently Asked Questions
Is Claude 3.5 Haiku still available?
Not on the Claude API. As of October 2026, Anthropic lists Claude Haiku 3.5 as retired, except on Amazon Bedrock and Google Cloud. The current low-cost Claude model is Haiku 4.5 at $1 per million input tokens and $5 per million output tokens.
How much does TOON save with current Claude models?
In the current official TOON benchmark (5,856 LLM calls), TOON used 42.6% fewer tokens than JSON and scored 72.2% accuracy versus 71.4% for JSON. Claude Haiku 4.5 scored 65.6% on TOON versus 63.5% on JSON. Savings are largest on uniform arrays and smallest on deeply nested data.
Does the newer Claude tokenizer affect TOON savings?
Claude 4.7 and later models use a tokenizer that Anthropic says produces approximately 30% more tokens for the same text. That raises absolute token counts for both JSON and TOON. Count tokens on your own data with Anthropic's token-counting endpoint rather than assuming a fixed percentage.
Conclusion
Claude models have changed a lot since Claude 3.5, but the economics of structured data have not: every repeated key is a billed token. With the 4.7+ tokenizer counting more tokens for the same text, compacting your data matters more on current models. TOON removes about 43% of those tokens on average, with no measured accuracy loss on Claude Haiku 4.5 in the official benchmark.
Recommended Reading
Gemini 3.8 Flash Doubles in Price in 2027: Cut Tokens Now
Gemini 3.8, 3.7 and 3.6 Flash prices double on January 1, 2027. Estimate the impact on your bill and how much sending fewer tokens with TOON can offset.
How to Calculate Your LLM Token Savings from TOON
A simple cost model for TOON token savings: tokens times price, minus the prompt tax, stacked with batch and caching discounts. With a worked example.
Building an MCP Server That Returns TOON
Building an MCP server that returns TOON instead of JSON. Tool results dominate agent token budgets; the input/output format split keeps it reliable.