LLM Token Optimization Blog & Resources
Insights on data formats, LLM optimization, and reducing API costs. Learn about TOON and TONL formats, or try our free converter.
All articles
TOON in Production: Lessons From Halodoc's 5–15% Savings
Halodoc moved real LLM workloads from JSON to TOON and cut cost 5–15% and p95 latency 1–12%. What drove the results, and how to run your own migration test.
Is TOON Safe for AI Agents? What the 2026 Research Says
A 2026 arXiv study found TOON saves up to 18% of tokens in agent loops but costs about 9 accuracy points on open models. Where it helps and where it breaks.
TOON vs TRON vs JTON: Token-Efficient Formats Compared
TOON has rivals: TRON's class-based rows and JTON's Zen Grid. Compare syntax, published token savings, accuracy evidence and maturity before you commit.
TOON Nested Field Groups: Nested Objects in TOON Tables
TOON nested field groups put uniform nested objects inside table rows with headers like customer{name,country}. Contacts data shrank 66.5% vs JSON.
TOON Keyed Tables: Encoding Maps of Objects in Fewer Tokens
TOON keyed tables collapse objects keyed by ID or name, like feature flags or user maps, into one table. Syntax, rules and the 54.6% savings vs JSON.
TOML 1.1: What's New and How to Convert TOML to JSON
TOML 1.1 adds multi-line inline tables with trailing commas, optional seconds in times and new escapes. What changed since 1.0 and how to convert TOML to JSON.
JSON vs YAML: Differences, Use Cases and How to Convert
JSON vs YAML compared on syntax, comments, types, safety and token cost. YAML 1.2 is a strict superset of JSON. When to use each and how to convert both ways.
JSON Schema 2020-12: A Practical Validation Guide
JSON Schema 2020-12 is the current draft and the default for MCP tool schemas. Learn the core keywords, common mistakes and how to validate JSON online.
How to Decode a JWT (and Why Decoding Is Not Verifying)
Decode a JWT in your browser: split the header, claims and signature, read exp and aud, and learn why decoding a token is not the same as verifying it.
How to Convert XML to JSON Without Losing Attributes
Convert XML to JSON without losing data: plan for attributes, repeated elements, mixed content and namespaces. Mapping rules, examples and a free converter.
Fix Invalid JSON From LLMs: Truncation, Commas, Quotes
Fix invalid JSON from LLMs: truncated output, trailing commas, single quotes and code fences. How to repair it, when to use structured outputs, and a free tool.
How to Convert JSON to CSV (Including Nested JSON)
Convert JSON to CSV correctly: flatten nested objects, quote commas and line breaks per RFC 4180, handle arrays, and open the result cleanly in Excel.
TOON vs Minified JSON: When Compact JSON Wins
The latest TOON benchmark shows compact JSON beats TOON on mixed, nested data, while TOON wins big on uniform tables. Here is how to choose for your payload.
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.
Migrating to TOON v4: Breaking Changes and Upgrade Checklist
Upgrading from TOON v2/v3 to v4? Key folding is gone, # lines are now comments, and decoders must upgrade first. A step-by-step checklist with fixes.
TOON v4: Keyed Tables, Nested Field Groups and Comments
TOON spec 4.1 adds keyed tables for maps of objects, nested field groups and full-line comments, and drops key folding. What changed and why it matters.
Writing an llms.txt File: A Practical GEO Guide
llms.txt is a markdown file that points AI crawlers to your best content. How to write one, what to include, and an honest look at how much it helps in 2026.
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.
Running TOON with Ollama and Local LLMs
Local models have small context windows. Learn how TOON's compact tables stretch limited context when running Llama, Phi, and Qwen on Ollama.
Feeding Financial and Market Data to LLMs with TOON
Financial data like prices, trades and time series forms dense uniform tables, TOON's best case at up to 59% fewer tokens. Format market data for LLM analysis.
Validating TOON Data: Schemas, Round-Trips, and Lint Checks
Validating TOON data: the header declares row count and fields, a built-in checksum. Practical checks from round-trips to lint rules and TONL schema validation.
Token-Efficient Apps with TOON and the Vercel AI SDK
How to format context as TOON inside Vercel AI SDK apps to cut input tokens—while keeping generateObject and tool calls on JSON for reliable structured output.
Context Window Management: Fitting More In with TOON
Context windows are finite and every token costs money. TOON cuts about 43% of tokens on average, up to about 59% on flat tables. Fit more rows and prioritize.
From HTML Tables to TOON for LLM Extraction
HTML tables scraped from the web are verbose and noisy for LLMs. Convert them into clean TOON tables, the structure LLMs read best, for accurate extraction.
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.
Few-Shot Prompting with TOON: Cheaper, Clearer Examples
Few-shot examples repeat in every prompt, so their format compounds. TOON-encoded example tables cut tokens; output examples should match your target format.
MongoDB & NoSQL Documents to LLMs: JSON vs TOON
NoSQL documents range from uniform collections to deeply nested blobs. Learn when MongoDB data is a TOON sweet spot and when to keep it as JSON.
Using TOON with Google Gemini
TOON with Google Gemini: Gemini 3.6 Flash read TOON as accurately as JSON in the official benchmark. Feed TOON context to the Gemini API and its large window.
Knowledge Graphs vs TOON Tables for LLM Facts
Knowledge graphs vs tables: research found tables beat graphs and JSON on factual LLM tasks by 40.29%. When to flatten facts into TOON and when to keep a graph.
How TOON Handles Nested and Non-Uniform Data
TOON shines on uniform arrays, but real data nests. How TOON represents nested objects and mixed structures, where savings drop, and when JSON or YAML wins.
Compressing REST API Responses for LLMs with TOON
REST endpoints over-fetch and repeat keys on every record. Learn how to convert REST JSON responses into TOON tables before sending them to an LLM.
Using TOON with Claude: Token Savings and Prompt Caching
How to pass TOON context to Claude, why to benchmark accuracy on your model first, and how Anthropic's 90% cache-read discount stacks with TOON's token savings.
Formatting Vector Database Results as TOON for RAG
Vector database results from Pinecone, Weaviate or pgvector share a schema, ideal for TOON. Format retrieved nodes and metadata to fit more evidence per window.
TOON vs JSON5 and HJSON: Human-Friendly vs Token-Friendly
JSON5 and HJSON make JSON pleasant for humans to edit; TOON makes data cheap for LLMs to read. Why these formats solve opposite problems, and when to use each.
Feeding GraphQL Responses to LLMs with TOON
GraphQL trims which fields you fetch; TOON trims how you serialize them. Combine a precise selection set with TOON encoding to cut LLM input tokens twice over.
Using TOON with GPT-5 and the OpenAI API
TOON with GPT-5 and the OpenAI API: where TOON cuts input tokens, where to keep JSON for structured outputs, and how prompt caching stacks on top.
How to Format Data So AI Engines Cite You (GEO Guide)
Format data so AI engines cite you: answer engines quote statistics, sources and tables. Tactics backed by the Princeton GEO study for ChatGPT and AI Overviews.
Time-Aware Data in TONL: @now, @today and Temporal Queries
TONL temporal queries: built-in @now and @today primitives filter by time without date math. How to model, query, and validate time-aware data in TONL.
TONL vs SQLite for Local Structured Data and LLM Apps
TONL vs SQLite: SQLite is a query engine in a file; TONL adds queries, schema, streaming and an LLM-ready text format with zero dependencies. How to choose.
TONL Compression: Dictionary, Delta, RLE & Bit Packing
TONL compression layers explained: Dictionary, Delta, RLE, Bit Packing, Column Reorder and Quantizer, what each one does to token counts and when it pays off.
Choosing TOON Delimiters: Comma, Tab, or Pipe?
TOON delimiters: comma, tab, or pipe. How each affects tokenization, quoting, and readability, and how to pick the right one for your data and model.
Does TOON Save Tokens on Every Tokenizer? GPT, Claude, Llama
TOON token savings depend on the tokenizer. How reductions hold across o200k_base, Claude, Gemini and Llama vocabularies, and why to count on your own model.
Building Fine-Tuning Datasets: JSONL Wrappers, TOON Content
Fine-tuning datasets stay JSONL, but the data inside each example doesn't have to be JSON. TOON content trims training tokens and teaches models to read tables.
TOON as the Wire Format for Multi-Agent Systems
Multi-agent systems re-tokenize every message at each hop, so format overhead compounds. Why TOON is a strong inter-agent wire format, and where to keep JSON.
Compressing Chat History with TOON for Cheaper Conversations
Chat history grows every turn and you pay for it on every request. TOON-encoded message arrays plus prompt caching keep long conversations inside budget.
LLM Log Analysis at Scale: Why TOON Beats Raw JSON Logs
LLM log analysis: application logs are huge, uniform and repetitive, where JSON wastes the most tokens. TOON and TONL streaming make log triage affordable.
Chunking Strategies for TOON in RAG Pipelines
Chunking TOON for RAG: how to chunk, retrieve, and format TOON context so field-retrieval accuracy matches JSON while far more evidence fits in the window.
Spreadsheets to LLMs: Converting Excel & CSV Data to TOON
Spreadsheet data for AI analysis: when to send it as CSV, TOON, or TONL, and how to convert Excel and Google Sheets exports into token-efficient prompts.
Feeding SQL Query Results to LLMs: TOON vs JSON Result Sets
SQL query results are a uniform table, TOON's best case. Converting result rows to TOON cuts about 59% of tokens on flat tables with near-perfect retrieval.
Halving Costs Twice: The OpenAI Batch API Plus TOON
The OpenAI Batch API takes 50% off input and output tokens; TOON removes about 43% of them first. Combine async batching and compact formatting for bulk jobs.
Stacking TOON with Prompt Caching to Cut LLM Costs Further
Prompt caching cuts the price per token up to 90%; TOON cuts token count by about 43% on average. Combine both levers for compounding savings on Claude and GPT.
TOON, Structured Outputs & Function Calling: Which Format?
Function calling with TOON: use JSON and constrained decoding for what the model writes, TOON for what you feed in. Split input and output formats by direction.
How LLM Tokenization Works (and Why TOON Saves Tokens)
How LLM tokenization works: Byte Pair Encoding, tiktoken and the o200k_base vocabulary, and why repeated JSON braces and quotes cost tokens that TOON removes.
Parquet & Avro vs TOON: Storage Formats Meet LLM Formats
Parquet and Avro dominate big-data storage, but they're binary and built for disks, not prompts. The store-in-Parquet, serialize-to-TOON pattern for AI apps.
MessagePack vs TOON: Binary Wire Format vs LLM Tokens
MessagePack is about half the size of JSON on the wire, but binary data Base64-bloats in LLM prompts. Why TOON wins for prompts and MessagePack for transport.
Markdown Tables vs TOON: Which Saves More LLM Tokens?
Markdown tables vs TOON for LLM prompts: pipes and dashes add token bloat. TOON keeps the table structure LLMs read best, worth a 40% accuracy gain, without it.
JSON vs NDJSON vs TOON: Differences and How to Convert
JSON vs NDJSON explained: one array vs one object per line. How to convert NDJSON to JSON with jq, JS or Python, and when TOON beats both in LLM prompts.
TOON Syntax Cheat Sheet: Every Rule on One Page
A one-page TOON reference: objects, lists, tabular arrays, delimiters, quoting, nesting, and edge cases—each with a side-by-side JSON example.
Designing TONL Schemas: Types, Validation & TypeScript
TONL schemas in practice: type hints (u32, str, bool), validation rules, and auto-generated TypeScript types, while staying smaller than JSON.
Querying Data Without a Database: TONL's SQL-Like Query API
TONL ships a SQL-like query API with sub-0.1ms indexed lookups. Learn how to filter, aggregate, and join structured data without spinning up a database.
Streaming Multi-Gigabyte Datasets to LLMs with TONL
TONL streams 50GB+ files in under 100MB of memory. Learn how streaming, indexing, and sub-millisecond queries make huge datasets usable in AI pipelines.
Embeddings & Binary Data: TOON and TONL vs Base64-in-JSON
Embeddings, images and binary blobs in TOON and TONL versus bloated Base64-in-JSON, and when to keep binary data out of the LLM prompt entirely.
Edge AI on a Token Budget: Running Local LLMs with TOON
Small local models like Llama and Phi have tiny context windows. Learn how TOON's compact tables stretch limited context for on-device and edge AI.
Parsing Speed vs Token Efficiency: The Real TOON Trade-off
Does saving tokens cost you parsing speed? A look at the trade-offs between JSON.parse, CSV, and TOON encoding/decoding for high-throughput LLM applications.
The Token Economy: Why Data Format Is AI's Hidden Cost Lever
Tokens are the unit of AI economics. Here's why the format you serialize data in—JSON, TOON, or TONL—quietly determines your LLM bill and context budget.
TOON in Python and JavaScript: A Hands-On SDK Guide
Install, encode, decode, and validate TOON in Python and JavaScript/TypeScript with copy-paste examples and a JSON-to-TOON migration checklist.
Using TOON with LangChain and LlamaIndex
Custom output parsers and document formatting to feed TOON-encoded context into LangChain and LlamaIndex pipelines for materially lower token usage.
Token-Efficient AI Agents: TOON for Tool Calls and MCP
How to cut token costs in AI agent loops and MCP servers by passing tool results as TOON instead of JSON, with concrete patterns and caveats.
When NOT to Use TOON: The Prompt-Tax Trap
When not to use TOON: the 'prompt tax', the data shapes where JSON or CSV win, and a framework for choosing an LLM data format for each payload.
TOON Benchmarks 2026: Token Savings and Accuracy by Model
TOON benchmarks vs JSON across 5,856 LLM calls: 42.6% fewer tokens at 72.2% vs 71.4% retrieval accuracy, with per-model and per-data-shape results.
Stop Using JSON for LLMs: The Case for Token Efficiency
Why JSON is costing you money and performance in AI applications, and how switching to TOON can reduce token usage by about 43% on average.
Niche Developer Tools You Probably Aren't Using (But Should)
Warp, Ray, and HTTPie can supercharge your dev workflow. Learn how TOON makes sharing their output with AI cheaper, and when TONL is the better fit.
Why LLMs Agree With You (And How TOON Helps)
Why LLMs agree with wrong premises, how sycophancy breaks RAG, and how TOON few-shot examples make judge evals cheaper. Plus where TONL fits.
Why LLMs Hallucinate and How TOON Optimizes Reasoning
Why LLMs hallucinate, how TOON cuts syntax noise to improve grounding and reasoning, and how TONL schemas and queries add guardrails for RAG pipelines.
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).
Green AI: The Environmental Case for Token Efficiency
Explore the environmental impact of AI and how processing fewer tokens with efficient data formats like TOON contributes to sustainable coding practices.
Build a Cost-Efficient Chatbot with Next.js & Vercel AI SDK
A step-by-step tutorial on building a chatbot using Next.js, Vercel AI SDK, and TOON for efficient tool calling and data passing.
TOON Best Practices: Naming, Nesting, and Error Handling
TOON best practices for naming, nesting, and troubleshooting strict-mode conversion errors.
Migrating from JSON to TOON: A Practical Guide
A practical guide for developers migrating their data from JSON to TOON. Learn about common pitfalls, regex vs parsers, and validation strategies.
The Architecture of TONL: A Look Under the Hood
Explore TONL's architecture for schemas, validation, and streaming in an AI-native data platform.
Optimizing RAG Pipelines with TOON
Learn how replacing JSON with TOON in your RAG context chunks can significantly reduce token usage, lower latency, and cut API costs.
Protobuf vs TOON: Binary Speed vs Token Efficiency
Compare Google's Protocol Buffers with TOON. Learn why binary formats struggle with LLMs and how TOON provides a token-optimized alternative.
Protobuf vs TONL: The Schema Battle for the AI Era
A deep dive comparing Protobuf's binary serialization with TONL's AI-native data platform. Discover which typed format is right for your architecture.
Introducing Protobuf Support: Efficient Serialization
Learn how to convert between JSON and Protobuf using our new tool. Discover the benefits of Protobuf's schema-driven approach and binary efficiency.
Understanding CSV: Complete Guide to Comma-Separated Values
Deep dive into CSV format: RFC 4180 standard, common challenges, quoting rules, type handling, and best practices for data interchange.
YAML vs TONL: Complete Feature Comparison for AI Development
Compare YAML vs TONL for LLM applications: advanced features, performance benchmarks, query capabilities, and when to use each format.
TOON vs YAML: Which Format Uses Fewer LLM Tokens?
TOON vs YAML for LLM prompts: TOON uses about 29% fewer tokens than YAML in the official benchmark at similar accuracy. Syntax, edge cases, when to use.
TOML vs TONL: Feature Comparison for Modern AI Applications
Compare TOML vs TONL: query API, schema validation, streaming, and advanced optimization for LLM-powered applications.
TOML vs TOON: Config Format vs LLM Data Format Compared
TOML vs TOON: TOML is for hand-edited config, TOON for LLM prompt data. Array-of-tables vs header rows, token cost, dates, and when to use each format.
CSV vs TONL: Tabular Data Format Showdown for AI
Compare CSV vs TONL for LLM data: advanced features, indexing, nested data support, and enterprise-grade capabilities.
CSV vs TOON: Which Format for Your LLM Data?
Compare CSV vs TOON for LLM prompts: flat vs structured data, type safety, token efficiency, and when to use each format.
XML vs TONL: Data Format Comparison for AI Applications
Compare XML vs TONL for LLM applications: query capabilities, streaming, schema validation, and advanced optimization strategies.
XML vs TOON: Complete Format Comparison for LLM Optimization
Compare XML vs TOON for LLM prompts: token efficiency, verbosity analysis, and a worked example where TOON uses 69% fewer tokens than XML.
TOON vs TONL: Comparing Token-Optimized Data Formats
Compare TOON vs TONL for LLMs: key differences, performance benchmarks, and when to use each format to optimize AI API costs.
TONL Guide: Token-Optimized Language for LLMs
Discover TONL: production-ready format the TONL project says saves 32–45% tokens vs JSON. Learn features, queries, and optimization strategies.
TOON Format Specification: Grammar and Syntax Guide
Discover the official TOON (Token-Oriented Object Notation) specification, ABNF grammar, data types, and key syntax rules of this modern serialization format.
TOON vs JSON vs YAML: Token and Format Comparison (2026)
TOON vs JSON vs YAML (plus XML, TOML, CSV): TOON uses about 43% fewer tokens than JSON at equal LLM accuracy. Comparison table and when to use each.
Optimize OpenAI and Claude API Costs with TOON
Optimize OpenAI and Claude API costs with TOON, which averages about 43% fewer tokens than JSON. Practical guide with code examples and implementation steps.
JSON vs TOON for Large Language Models
An in-depth comparison of JSON and TOON data formats for LLM applications, analyzing token efficiency, performance, and when to use each format.
What Is TOON? Token-Oriented Object Notation Explained
TOON (Token-Oriented Object Notation) is a compact, human-readable format for LLM prompts that uses about 43% fewer tokens than JSON. Syntax and examples.