Jump straight to the numbers

← All articles

$2.53 for 10,000 JSON Jobs: Read the Receipt

01 / The $2.53 receipt starts with explicit assumptions

A small JSON response can be cheap. A small JSON response wrapped in a giant prompt, retried repeatedly, and repaired by another model can cost considerably more. Budget the complete job, not just its first API call.

Here is a planning example for 10,000 receipt-extraction jobs. These are hypothetical rates and workloads, not a CheapRelay price quote or a measured benchmark. Assume input costs $0.20 per million tokens, output costs $0.80 per million tokens, and every attempt uses 750 input tokens and 120 output tokens. The input includes instructions, receipt text, and a 150-token schema.

  • ■ Initial input: 10,000 × 750 = 7,500,000 tokens. Cost: $1.50.
  • ■ Initial output: 10,000 × 120 = 1,200,000 tokens. Cost: $0.96.
  • ■ First-attempt subtotal: $2.46.
  • ■ Retry allowance: 300 additional attempts, each with the same token counts. Cost: $0.0738.
  • ■ Total: $2.5338, or $2.53 rounded to cents.

That is about $0.000253 per completed job, assuming all 300 retried jobs succeed on their second attempt. The 3% retry allowance is a scenario assumption, not a promised failure rate. Application hosting, storage, taxes, and human review are outside this receipt.

02 / JSON mode buys syntax; schemas narrow the contract

JSON mode generally targets parseable JSON. It does not, by itself, establish that every required field exists, every value has the correct type, or an extracted total matches the receipt. A perfectly valid object can still contain the wrong amount.

Schema-constrained structured output can enforce supported structural rules when the selected model and endpoint provide that capability. Supported schema features vary. Neither structural enforcement nor successful parsing proves factual accuracy, and refusals or interrupted responses still need handling.

For receipt extraction, require a currency string, an amount in integer minor units, and a merchant field that permits null when unreadable. Validate those fields locally. Do not pay for a second model call merely to discover that a required key is missing.

03 / The schema costs $0.30 before retries

In this example, the 150-token schema contributes 1,500,000 input tokens across the initial 10,000 calls. At the assumed input rate, that is $0.30. Including its share of the 300 retries brings the schema contribution to $0.309.

That overhead may be worthwhile if it reduces unusable responses. But verbose field descriptions, repeated examples, and duplicated instructions are still billable input. Keep descriptions precise rather than decorative. Remove explanations of JSON syntax that the model does not need.

Prefer one compact object over an object plus a prose explanation. Set an output limit with enough room for the expected object; an aggressively low limit can truncate JSON and create the retries you were trying to avoid.

04 / Retry only the failure you can identify

Separate transport errors, malformed output, schema failures, and business-rule failures. They need different remedies. A timeout may justify a bounded retry. An impossible date needs validation. Missing source information should usually become null or a review flag, not an invitation to guess.

  • ■ Parse and validate locally before accepting the result.
  • ■ Allow one targeted retry for a repairable failure.
  • ■ Include repair instructions in the retry token budget.
  • ■ Send persistent failures to a review queue instead of an unlimited loop.

The receipt assumes retries consume exactly as many tokens as initial attempts. Real repair prompts may be longer. Record actual usage rather than treating this simplified estimate as an invoice.

05 / Check route support before funding the workload

CheapRelay provides pay-as-you-go access with one key and no monthly fee or subscription. Its OpenAI-compatible routes sit under https://api.cheapapirelay.com/v1; Gemini-native routes sit under /v1beta. SDK compatibility alone does not establish support for a particular structured-output option. Check the selected model and route before committing a batch.

CheapRelay bills real tokens, including cache reads and writes. This example assumes uncached input; calculate cache charges separately using the applicable rates. Sign up for CheapRelay, test a small representative batch, and replace every assumption above with your observed token counts and current prices.

Sign up Try the prices yourself, sign-up credit included.

More reading

DateAisleWritten inTitle
2026-10-26Spend lessEN$30 a Month for AI: An Indie Hacker’s Receipt
A $30 monthly AI budget with token math, cache allowances, retry limits, and practical spending controls for solo builders.
2026-10-26Spend lessEN$3.45 for 95 accepted answers beats cheap tokens
A worked receipt shows why token prices can mislead: count retries, rejected outputs and cache charges before ranking models.
2026-10-26Spend lessENThe $0.004 AI Task With a $0.0566 Agent Receipt
A hypothetical agent receipt shows how context, retries, evaluation and logging turn a $0.004 task into $0.0566 per accepted result.
2026-10-26Spend lessEN$0.012 Either Way: Streaming Changes the Habit
A token-by-token receipt shows why streaming has no automatic discount, but stopping early and avoiding retries can change your API bill.
2026-10-26Spend lessEN$1.71 to $1.02: A Long-Chat Summarisation Receipt
A worked token receipt shows when summarising chat history saves money, including the summary fee, break-even point and caching caveats.
2026-10-26Spend lessEN¥0.32 for a 100,000-token translation batch
A worked translation receipt shows how to rank model quotes by yuan spent, then adjust for retries, cache charges and human review.