Structured Extraction Schema Token Cost

Compare token cost of simple vs complex JSON extraction schemas at scale

Paste two JSON extraction schemas and see how many tokens each adds to every request, plus the monthly cost difference at your request volume. Helps you decide whether 50 fields is worth the bill versus a leaner 5-field schema. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How are schema tokens estimated?

The tool uses a character-based heuristic of roughly 4 characters per token, which closely tracks how GPT and Claude tokenizers treat compact JSON. It is an estimate, not an exact tokenizer count, but is accurate enough for budgeting.

Structured extraction schema token cost

When you use function calling or JSON-schema structured output, the schema itself is part of the prompt — it is re-sent on every request. A rich 50-field schema with descriptions can quietly add hundreds of input tokens to each call. Paste two schemas, set your daily volume, and this tool shows the per-request token overhead and the monthly cost difference.

How it works

The tool measures each schema’s character length and estimates tokens at the standard ~4 characters per token ratio that compact JSON tends to follow. It then multiplies the per-request overhead by your daily request count and your model’s input price (per million tokens) to project monthly spend for each schema:

schema_tokens   ≈ schema_characters / 4
monthly_cost    = schema_tokens / 1,000,000 × input_price × requests/day × 30

The difference between the two schemas is the money you save (or spend) purely by changing the shape of what you extract.

Worked example

Suppose you extract invoice data. A “rich” schema with 40 fields and verbose descriptions weighs around 2,800 characters — roughly 700 tokens. A lean schema with 8 essential fields might be 400 characters — around 100 tokens. That is a 600-token difference per request.

At 10,000 requests per day and an input price of $2 per million tokens, the monthly overhead is:

Rich:   700 tokens × 10,000/day × 30 days / 1,000,000 × $2  =  $4.20/month
Lean:   100 tokens × 10,000/day × 30 days / 1,000,000 × $2  =  $0.60/month
Saving: $3.60/month

That looks modest, but at 500,000 daily requests the same gap becomes $180 a month saved from a schema redesign alone — with no model upgrade required.

What actually inflates schema size

Understanding which parts of a JSON schema are token-heavy helps you target cuts without losing extraction accuracy:

  • Field descriptions are the biggest culprit. A description string explaining what invoice_date means adds ~10–20 tokens per field. Remove them or condense to two or three words once the model is behaving correctly.
  • Nested objects compound costs: each nesting level repeats type, properties, and required boilerplate. Consider flattening when depth is not semantically meaningful.
  • Enum lists are verbatim strings. An enum with 30 country codes adds roughly 80 tokens; a free-text field with a prompt note costs far less.
  • Verbose field names accumulate. The 50 extra characters between dob and dateOfBirthInISO8601Format only cost ~12 tokens once, but multiplied over millions of calls that is real money.

Tips and notes

  • Strip long human-readable description strings from production schemas — they are billed on every call but rarely improve extraction accuracy enough to justify the cost at high volume.
  • Prefer short, unambiguous field names over verbose ones; dob costs fewer tokens than dateOfBirthInISO8601Format across millions of requests.
  • If only a few requests need the rich 50-field schema, route those separately and keep the cheap 5-field schema as your default path.
  • Use this tool iteratively: after trimming a schema, paste both the old and new versions to quantify exactly what you saved before deploying.
  • The 4 characters per token heuristic is a reasonable budget estimate. For a precise count, run both schemas through the model’s own tokenizer (the tiktoken library for OpenAI models, for example) once you have finalised the design.