Structured Output Token Overhead Calculator

See how JSON mode or structured outputs inflate token costs

Ad placeholder (leaderboard)

Structured output token overhead calculator

Forcing a model to return strict JSON, a fixed schema, or tool-call arguments is convenient — but every brace, quote, key and comma is output tokens the model has to generate and you have to pay for. This tool estimates how much extra you spend by demanding structured output versus letting the model answer in plain prose.

How it works

Output billing is per token, and structural characters are not free. Consider a single field:

"customer_name": "Jane Doe"

The value is Jane Doe, but you also pay for the key customer_name, two pairs of quotes, a colon and the surrounding braces and commas. Across a deeply nested schema with many keys, this “syntax tax” can add 20–60% to the output token count. The calculator counts the non-value (structural) characters in the schema you paste, converts them to tokens at roughly 4 characters per token, and compares the full JSON token count against the freeform baseline you provide.

Tips to cut structured-output cost

  • Use short, flat keys (id not customer_identifier) — keys repeat on every record and add up fast in arrays.
  • Avoid pretty-printing in production; request minified JSON with no extra whitespace or newlines.
  • For long lists, consider returning CSV or newline-delimited values when a strict schema is not required — far less punctuation per row.
  • Cache the prompt/schema where the provider supports prompt caching so the input side of the schema is cheaper, even though the output side still costs.
Ad placeholder (rectangle)