8 min read

Halving Costs Twice: The OpenAI Batch API Plus TOON

The Batch API takes 50% off input and output tokens; TOON removes 40-60% of them first. Here's how to combine async batching and token-efficient formatting for bulk LLM jobs.

By JSON to TOON Team

To cut OpenAI batch costs with TOON, combine two independent discounts: the Batch API takes 50% off both input and output tokens for async jobs, and TOON removes 39.9% of tokens overall — up to 58.8% on flat tables. Because fewer tokens enter the 50%-off pricing tier, the reductions multiply rather than add.

What the OpenAI Batch API Actually Costs

The OpenAI Batch API is designed for work that does not need an immediate response: bulk document classification, large-scale extraction, embedding generation, offline report creation. You submit a JSONL file of requests, and the API processes them asynchronously with a 24-hour turnaround window — though according to OpenAI pricing documentation, most batches complete within 1 to 6 hours.

In exchange for that latency tolerance, you receive a 50% discount on both input and output tokens. The batch pool also has a separate, higher rate-limit allocation than the standard synchronous API, which matters for high-volume jobs. There is no special model: the same GPT-5, GPT-4o, and other models are available; you simply route calls through the batch endpoint.

The discount also stacks with prompt caching. For GPT-5.4, a cached batch input can reach $0.625 per million tokens — roughly 75% off the $2.50 standard input rate. TOON sits on top of both: it reduces the token count before any pricing tier is applied.

Why Bulk Jobs Are Exactly Where TOON Saves the Most

The official toonformat.dev benchmarks ran 5,016 LLM calls across 209 questions, six formats, and four models (Claude Haiku, Gemini 3 Flash, GPT-5 Nano, Grok 4.1). TOON achieved 39.9% fewer tokens than JSON overall, with a peak reduction of 58.8% on flat uniform tables (67,778 vs 164,452 tokens). It also maintained higher retrieval accuracy: 76.4% vs JSON's 75.0%, at 27.7 accuracy-points per thousand tokens versus JSON's 16.4.

Bulk classification and extraction jobs almost always involve arrays of similar objects — rows from a database, records from a CSV export, product entries, support tickets. That is precisely the data shape where TOON's per-row savings are largest. Each row in a JSON array repeats every key name and every structural glyph. TOON declares fields once in the header and reduces each row to values and delimiters. The larger the batch, the more aggressively the savings compound.

For background on the token-level mechanics, see why JSON is wasteful for LLM prompts and the API cost optimization guide.

Bulk Classification Input: JSON Array vs TOON Table

Consider a batch classification job: label 500 support tickets by category and urgency. Each request in the JSONL batch file contains a small context block plus the ticket data. Here is the data portion of a single batch request, shown as JSON and as TOON:

// ── JSON format — per-request data block (~52 tokens for 5 tickets) ──────
[
  {"ticket_id": "T1001", "subject": "Login broken",        "body": "Cannot sign in since update.", "priority": "high"},
  {"ticket_id": "T1002", "subject": "Slow dashboard",      "body": "Reports take 30s to load.",    "priority": "medium"},
  {"ticket_id": "T1003", "subject": "Export fails",        "body": "CSV export returns 500.",      "priority": "high"},
  {"ticket_id": "T1004", "subject": "Wrong invoice total", "body": "Charged $50 extra this month.","priority": "medium"},
  {"ticket_id": "T1005", "subject": "Feature request",     "body": "Add dark mode please.",        "priority": "low"}
]

// ── TOON format — same data (~27 tokens, ~48% reduction on this slice) ──
tickets[5]{ticket_id,subject,body,priority}:
  T1001, Login broken,        Cannot sign in since update.,  high
  T1002, Slow dashboard,      Reports take 30s to load.,     medium
  T1003, Export fails,        CSV export returns 500.,        high
  T1004, Wrong invoice total, Charged $50 extra this month., medium
  T1005, Feature request,     Add dark mode please.,          low

Across 500 tickets batched in groups of 5, the difference in input tokens is substantial. At batch pricing, you are paying for fewer tokens at a lower rate. If you also place the classification instructions and schema in a cached prefix (which is identical on every call in the batch), the cache discount applies to that portion too.

Standard Sync vs Batch vs Batch Plus TOON: Cost Comparison

The table below shows the relative effect of each strategy on a data-heavy workload. Token figures are illustrative — actual counts depend on your data and model. Pricing is based on cited OpenAI rates. The baseline is a synchronous JSON request at standard input pricing.

ApproachFormatToken count (relative)Input price (relative)Effective cost (relative)
Standard syncJSON100%100%100%
Standard syncTOON (avg)~60%100%~60%
Batch API (50% off)JSON100%50%50%
Batch API (50% off)TOON (avg)~60%50%~30%
Batch API (50% off)TOON (flat table)~41%50%~21%
Batch + cached prefix (GPT-5.4)TOON (flat table)~41%~25% (cached batch rate)~10%

The bottom row — batch API, TOON-encoded flat table, with a cached static prefix — represents close to the current practical floor for input costs on a data-heavy repetitive workload. Output token savings also apply: if your extraction response is a structured list matching the same schema, TOON on the output side (used carefully) can further reduce output token count, though for generation tasks JSON remains more reliable per the 2026 arXiv study on TOON vs JSON generation accuracy.

Implementation Checklist for Batch Plus TOON

Before running a batch job with TOON-encoded inputs, verify the following:

  • Data shape. TOON's savings are largest on uniform arrays. If your batch items vary significantly in schema, the reduction will be closer to 20% than 59%. Check the data shape before committing to the integration.
  • Minimum row count per request. The TOON format header (the array[n]{fields}: line) costs a fixed number of tokens. For very small per-request payloads (fewer than roughly 10 rows), the overhead may erode savings. Batch multiple records per request where the task allows it.
  • Model accuracy. The official benchmarks show a large variance by model: Gemini 3 Flash at 96.7% vs Claude Haiku at 59.8% on TOON inputs. If you are using a model that scores lower, validate accuracy on a sample before processing the full batch.
  • Format instructions in the system prompt. Include a brief TOON format explanation in the system prompt (which you can place in the cached prefix). This is the one-time overhead that amortizes across the entire batch.
  • Output format. Request JSON output, not TOON output. The arXiv 2603.03306 study found that plain JSON outperforms TOON on generation tasks. Use TOON for input, JSON or structured outputs for the response.

The sibling post Stacking TOON with Prompt Caching covers the caching mechanics in more detail, including Anthropic's 90% cache-read discount and how to structure the stable prefix.

When the Batch API Is Not the Right Tool

The 50% discount comes with a hard constraint: asynchronous delivery with up to a 24-hour window. This rules out any latency-sensitive use case. Do not use the Batch API for:

  • Real-time user-facing responses (chatbots, copilots, search augmentation)
  • Workflows that require each result before submitting the next request (sequential pipelines)
  • Jobs where data freshness matters more than cost (live dashboards, event-driven triggers)

For those workloads, the combination of TOON encoding and prompt caching alone still delivers meaningful savings without the latency trade-off. See the guide to cost-efficient LLM chatbots for the real-time pattern.

Frequently Asked Questions

How do I cut OpenAI batch costs with TOON?

Use the OpenAI Batch API for async jobs (50% off input and output tokens) and encode each request's data payload as TOON instead of JSON. TOON removes 39.9% of tokens overall and up to 58.8% on flat uniform tables. Because you are billed on fewer tokens at a lower rate, the savings compound rather than add.

What discount does the OpenAI Batch API offer?

The OpenAI Batch API gives a 50% discount on both input and output tokens for asynchronous requests. Jobs have a 24-hour turnaround window, though most complete within 1 to 6 hours. Batch requests also draw from a separate, higher rate-limit pool than synchronous calls.

Does the Batch API discount stack with prompt caching?

Yes. On OpenAI, the Batch API's 50% discount stacks with prompt caching. For GPT-5.4, a cached batch input can reach $0.625 per million tokens — roughly 75% off the $2.50 standard input rate. Encoding the cached prefix as TOON reduces the token count further, compounding the savings.

Is the Batch API suitable for real-time applications?

No. The Batch API is designed for offline, non-time-sensitive work: bulk classification, extraction, embedding generation, and report creation. The 24-hour turnaround (typically 1 to 6 hours) makes it unsuitable for interactive or latency-sensitive flows. For those, use the standard API and rely on TOON and prompt caching alone.

How much does TOON reduce tokens on tabular data?

According to the official toonformat.dev benchmarks covering 5,016 LLM calls, TOON reduces tokens by 39.9% overall versus JSON. On flat uniform tables the reduction reaches 58.8% (67,778 vs 164,452 tokens). Bulk classification and extraction jobs typically involve exactly this kind of repetitive, uniform data, making TOON a strong fit.

Recommended Reading

OpenAIBatch APITOONCost OptimizationToken EfficiencyLLM