$1 Budget: 100 Structured JSON Calls
01 / JSON mode is a parser promise, not a smarter model
JSON mode and structured output do not make a model more accurate or more clever. They change one thing: the shape of the text that comes back. Without them, a model can answer with a sentence, an apology, a fenced code block, or three fields followed by a paragraph of commentary. With JSON mode enabled, the decoder is constrained so the reply parses as JSON. With structured output, the constraint is tighter: the reply must match a schema you supplied, with the keys you named and the types you declared.
That shape matters on a tiny budget because invalid output is never free. A reply that almost parses still cost you its input tokens and its output tokens, and now you pay again for a retry. On a relay that bills per real token, including cache reads and cache writes, with no monthly fee, every wasted generation shows up on the receipt. The cheapest valid JSON is the one you got right on the first call.
- ■ json_object mode: guaranteed valid JSON object, keys and types are still up to the model.
- ■ json_schema mode: valid JSON plus the fields and types you declared, usually the safest default.
- ■ Enums: turn free text variants into one of three values, which shortens output.
- ■ Required fields: fewer nulls and fewer follow-up questions in later stages.
02 / A 100-call JSON job counted in tokens first
Before thinking in dollars, think in tokens, because dollars are just tokens multiplied by a price. Take a realistic small call: about 300 tokens of instructions, 200 tokens of schema and examples, and 150 tokens of JSON output. That is 650 tokens per call. One hundred calls in a batch is 65,000 tokens. Written in millions, that is 0.065 million tokens.
Now multiply. If the model you pick bills at a rate of 1 dollar per million tokens as an arithmetic example, those 100 calls cost 6.5 cents, so a 1 dollar budget covers the batch with room for retries. If the rate is 5 dollars per million, the same batch costs 32.5 cents and 1 dollar covers roughly three batches. The token count did not change; only the multiplier did. Read the live price in your dashboard and run that one multiplication yourself rather than trusting a marketing claim.
Output tokens usually dominate a JSON job, because schemas are compact while structured replies are verbose. Field names, punctuation, whitespace and quoted strings all count. A model that returns 400 output tokens where you expected 150 more than doubles that part of the bill.
03 / Trimming the schema before it becomes input tokens
Your schema is sent with every request, so it is input tokens every time. A 200 token schema repeated across 100 calls is 20,000 tokens of the budget before the model answers anything. That is not a reason to drop the schema, it is a reason to stop decorating it.
- ■ Keep field names short and obvious: id, status, total beats invoice_identifier, current_processing_status.
- ■ Write one short description per field and skip the ones that are self-evident.
- ■ Prefer integer and enum types over strings so the model emits 3 and paid instead of a sentence.
- ■ Drop fields you only use for debugging; add them back for one call when you actually need them.
- ■ Cap list length in the instruction text, not with a long paragraph of rules.
One useful habit is to keep a tiny validation script that checks the reply against the same schema the request used. It runs locally, costs nothing, and tells you immediately whether trimming the schema broke anything. Trim in one step, run twenty test calls, compare parse success, then keep the smaller schema only if it still parses.
04 / One repair pass instead of three blind retries
When a reply fails validation, the instinct is to resend the same request. That spends full price for the same likely outcome. A better sequence: set temperature to zero or the lowest value the model accepts, validate the reply locally, and on failure send one repair call whose input includes the original reply plus the exact validation error. A repair call is usually short on input and short on output compared with a full retry.
- ■ Allow at most one repair pass and at most two total attempts per record.
- ■ Cap max_tokens at a realistic size so a runaway reply cannot eat the batch.
- ■ Log every attempt, so a 100 record job that silently becomes 180 calls is visible.
- ■ Stop the batch early when a failure rate spikes, instead of finishing and discovering it later.
Count repair calls in the same ledger as normal calls. If 8 out of 100 records need a repair pass, that is roughly 8 percent more tokens, which is affordable. If 40 need repairs, the schema or the prompt is wrong and no retry policy will save you money.
05 / The request shape that works on CheapRelay
CheapRelay is a pay-as-you-go relay where one key reaches a wide set of models, and it works with the OpenAI SDK, Claude Code, Codex and Gemini CLI. The OpenAI-compatible routes live under /v1 at api.cheapapirelay.com, and Gemini native routes live under /v1beta. For structured output, you send response_format with a json_schema payload on the OpenAI-compatible path, or a response schema with an application/json mime type on the Gemini native path. The rest of your code stays the same.
A budget-friendly pattern is to run the whole 100 record batch on one inexpensive model, such as Claude Haiku 4.5 or DeepSeek V4 Flash, and escalate only the handful of records that fail validation to a larger model. That keeps the expensive calls in the single digits while the bulk of the work stays at the low rate.
06 / The receipt line worth reading every day
Every response carries usage numbers: prompt tokens, completion tokens and total tokens, plus cached input where caching applies. Read them. Sum them per job, compare them with your estimate of 650 tokens per call, and investigate when the total drifts by more than a few percent. Caching helps only when the same prefix is reused inside the cache window, and cache reads and cache writes are billed as real tokens here, so treat them as cost rather than free lunch.
Set a hard ceiling per job and per day, and make your script stop when the ceiling is reached instead of hoping the batch ends first. With per-token billing and no monthly fee, that ceiling is the whole budgeting system. If you want to try this pattern today, sign up at CheapRelay and run a twenty-call batch first, then scale to 100 once the numbers on your receipt match your estimate.
Sign up Try the prices yourself, sign-up credit included.
More reading
| Date | Aisle | Written in | Title |
|---|---|---|---|
| 2026-10-30 | Spend less | EN | Two Receipts, 2 Million Tokens, $0.80 Saved Two receipts for the same 2 million tokens: one bills input and output, the other caches. Same results, $0.80 cheaper per cycle. |
| 2026-10-30 | Spend less | EN | Two Chatbot Receipts: $0.03 and $0.31 per Resolved Ticket Two support chatbot bills side by side, judged only on price per useful result, with the routing and caching math that cut spend. |
| 2026-10-30 | Spend less | EN | Software 0 Cents, AI Capped at 40,000 Tokens A beginner weekend plan for a receipt-sorting CLI: free tools, one API key, and a hard cap of 40,000 tokens. |
| 2026-10-30 | Spend less | EN | Tag 10,000 Feedback Lines for About $0.66 A beginner walkthrough: tag 10,000 feedback lines with a cheap model for roughly $0.66, plus batching, caching and a human review plan. |
| 2026-10-30 | Spend less | EN | One AI Request Costs $0.004: The Receipt Math Estimate cost per user for an AI feature on a tiny budget: token counting, cache billing, a $20/month worked example, and a receipt line that proves it. |
| 2026-10-30 | Spend less | EN | 50k tokens, one key, under $1: a fair price check A beginner, tiny-budget walkthrough for comparing official list prices with relay prices using per-token math, cache lines and a real receipt. |