29.10 How today's tools realize it
- Approved by
- Panaversity ·
Reference. Skim it now, and come back with your app open when you set a lever or port the week. Every product line here was read on the vendor's own page on November 30, 2026. Prices change, so copy them again on the day you use them.
In everyday life. You move to a new city and choose a phone plan. One company charges by the minute. One charges half at night. One sells you the phone and lets you run your own line. You do not compare the ads. You take last month's calls from your own bill and price them on each plan. Then you check that the cheaper plan still reaches the people you call. In this concept, the plans are AI vendors, last month's calls are your usage log, and the people you must still reach are your suite cases.
What you will learn. Where each lever of this chapter is set, and where you read what it cost. You use them in Lab 29, Tasks 1 to 4 on Claude, and in Task 6 on OpenAI and an open model.
- Where do you set the model, effort, caching and a batch on Claude, and where do you read the week?
- Which tiers and levers does OpenAI give you?
- What does an open model cost you?
- Which differences change a step, and what stays the same on every vendor?
Why it matters. Every vendor sells tokens. None of them sells a cost per accepted result. Each one puts the levers in a different place, with different defaults, so the same setting can mean a different thing on each. A comparison is fair only when you set each lever yourself and measure the same way on both sides.
At work. It is Wednesday, May 12, 2027. Yesterday's report to Dave Kowalski had a cache line and a tier line. Lab 29 ends with a port: the same week priced on OpenAI's models and on an open model. First you need to know where each vendor keeps its levers, and which defaults would change your numbers if you left them alone.
Where to set each lever in your app
On every vendor you set five things yourself: the model, the effort, the cache, the batch and the budget. Then you read the week from the vendor's report and your own log.
Claude: where each lever is
-
Pin the model. Name its id in the request's
modelfield, from one place in your code's config (21.13). From the 4.6 generation, an id has no date. It "maps to a single, fixed model snapshot", and "it is not an alias".1 The ladder on November 30, 2026:23Model API id Input / output, USD per million tokens Default effort Claude Haiku 5.5 claude-haiku-5-5$0.10 / $0.50 (prompts up to 100,000 tokens) mediumClaude Sonnet 5.5 claude-sonnet-5-5$2 / $10 highClaude Opus 5.5 claude-opus-5-5$4 / $20 mediumClaude Fable 5.2 claude-fable-5-2$8 / $40 highAll four have a 1M-token context window and 128K tokens of output.2
-
Set the effort. Put it in
output_config.effort, with one oflow,medium,high,xhighormax.4 Write the value even when it is the default. "Setting effort to the model's default ... produces exactly the same behavior as omitting the effort parameter",4 but the defaults differ by model, as the table shows. Effort is "a behavioral signal, not a strict token budget".4 The hard cap on output, thinking included, ismax_tokens.5 -
Place cache breakpoints. Add
cache_controlto a block, up to 4 per request, or set one top-levelcache_controlfor automatic caching.6 Add"ttl": "1h"for the one-hour cache. A cached part must be at least 512 tokens on Sonnet 5.5, Haiku 5.5 and Opus 5.5. A shorter one is processed uncached, with no error.6 Where to put the breakpoints is 29.7. -
Send a batch. Send requests to the Message Batches API, each with its own
custom_id: 1 to 64 letters, digits,_or-, unique in the batch.7 Readprocessing_statusuntil it isended, then match each result bycustom_id, because results come back in any order.7 A batch takes nostream: true, nofallbacksand no fast mode.7 Its requests are checked only when the whole batch has ended, so send one request of the same shape to the Messages API first.7 -
Set the dollar stop. For a hosted session on Claude Managed Agents, the session budget is a hard dollar cap, and a workspace spend limit is the last safety limit.8 The task budget for one agentic turn is in 29.9.
-
Read the week's usage. In the Console, the Usage page exports a CSV by API key and model.9 For code, the Usage and Cost Analytics API is in beta, behind the header
analytics-usage-cost-2026-08-24, and needs an Admin API key. It groups by up to five dimensions, such asmodel,workspace_idandapi_key_id.10 None of them is your step or your customer, which is why your code writes its own log (29.6). -
Check it took. Each response's
usageshowscache_creation_input_tokensandcache_read_input_tokens.6 A second request with the same start should show a read. Thinking tokens are inusage.output_tokens_details.thinking_tokens.5 When a read is missing, cache diagnostics names the first change, such asmodel_changedortools_changed.11
You use these steps in Lab 29, Tasks 1 to 4.
OpenAI: where each lever is
-
Pick the tier. OpenAI's prices on November 30, 2026, in USD per million tokens, for prompts up to 272K input tokens:12
Model Input Output Cached input gpt-6.2-astra$8.00 $40.00 $0.40 gpt-6.2-sol$2.00 $10.00 $0.10 gpt-6.1-terra$1.00 $5.00 $0.05 gpt-6-luna$0.10 $0.50 $0.01 Astra is the largest tier and Luna the smallest.12
-
Set reasoning effort. Use
reasoning.effortin the Responses API, orreasoning_effortin Chat Completions. The values depend on the model, and "can includenone,minimal,low,medium,high,xhigh, andmax".13 GPT-6.2 Astra and Sol rejectnone.13 The page gives no default for GPT-6.2, so write the value yourself. -
Leave caching on, or mark it. "Prompt caching is enabled by default for supported OpenAI models."14 The cached part must be at least 1,024 tokens. A write costs 1.25x input for the default 30 minutes, or 2.5x for 12 hours.14 To cache only where you choose, set
prompt_cache_options.modeto"explicit", with up to four cache writes a request.14 -
Send a batch. The Batch API costs half, with a
completion_windowof24honly. One input file holds up to 50,000 requests and 200 MB.15 Requests that expire go to the error file with the codebatch_expired.15 -
Check it took. An answer that is cut off has the status
incomplete, with the reasonmax_output_tokens, sometimes with no visible output. OpenAI suggests reserving at least 25,000 tokens when you start.13 How usage reports cached tokens is in F5.
You use these steps in Lab 29, Task 6.
Open source: OpenCode and a local model
- Choose the provider and the model in OpenCode. Choose for a session with
/models, for one run withopencode run --model provider/model, or as the default with"model"inopencode.json.16 If the configured model is unavailable, OpenCode "falls back to the newest available supported model".16 So check which model ran before you compare its cost. - Set effort as a variant. A variant carries the reasoning effort or a token budget, written
provider/model#variant.16 - Set the cache lifetime. Set
settings.cache.ttlfor each model, such as"5m"or"1h".16 - Read the price. Each provider's model carries a
costfield: input, output and an optional cache price per million tokens.17 Models used through a ChatGPT plan's sign-in "show no cost".17 Through OpenCode's own Console, each response reportsusage.costin USD. With your own provider's key, it addsopencode.estimated: true, because the cost is an estimate at the model's price.18 Console workspaces have monthly budgets, per workspace and per member.19 - Price a model on your own computer. An open-weight model run locally costs no money per token, and you manage its quality, speed and updates yourself (F6). You pay for the computer that runs it, and you run it.
- Run it safely. A local model server listens on your own computer only, as F6 checks. A provider's key stays in a file git ignores, never in a chat.
You use these steps in Lab 29, Task 6.
What changes a step
Three differences change what you do. Everything else is the same work in a different place.
| Claude | OpenAI | |
|---|---|---|
| The cache | You place it: breakpoints, or one automatic setting. At least 512 tokens on the current models | On by default. At least 1,024 tokens |
| Effort when you set none | medium on Haiku 5.5 and Opus 5.5, high on Sonnet 5.5 | Not stated for GPT-6.2 |
| A cut answer | stop_reason of max_tokens | status of incomplete, reason max_output_tokens |
The cache. On Claude, a request with no breakpoint and no automatic setting caches nothing.6 On OpenAI, caching is already on.14 So a port can change the cache share without any change to your code. Measure it again on the new vendor.
Effort. Write effort on every request of a comparison. A default you did not set makes two models differ in two things at once (29.3).
A cut answer. Chapter 25's stop-reason gate reads a different field on each vendor. Map both to the same gate, and count both as stopped, never as accepted.
What stays the same
The unit is one result accepted, on any vendor (29.6). A change to the price or the timing is checked by what it can break: the cache share, or the deadline. A change to the output runs the step's suite cases, three trials on each side, and keeps the same rule (29.3). And a price per token from another vendor is not a cost per accepted result until that vendor's model has passed the same cases.
The operating rule: before you compare two vendors, pin the model, and write effort and the output cap on every request. Recount the tokens on each vendor, because a list price per token is not a cost per accepted result.
Exam note. The developer exam's guide asks about Claude's model families, effort, caching, batch processing and token budgets. OpenAI and open source are on this page for practice only.
Product reference
For looking things up, not for reading through. Every line was read on November 30, 2026.
Claude: the ladder. Fable 5.2 claude-fable-5-2 $8 / $40, Opus 5.5 claude-opus-5-5 $4 / $20, Sonnet 5.5 claude-sonnet-5-5 $2 / $10, Haiku 5.5 claude-haiku-5-5 from $0.10 / from $0.50, per million tokens. Each has a 1M-token context window and 128K tokens of output.2 Anthropic says: "If you're unsure which model to use, start with Claude Opus 5.5 for most workloads."2 "Tuning effort is often a better lever than switching models."20 Output costs five times input on Haiku 5.5, Sonnet 5.5, Opus 5.5, Fable 5.2 and Fable 5.1.8
Claude: long prompts on Haiku 5.5. Over 100,000 input tokens, cache reads and writes included, the whole request pays $0.50 in and $2.50 out. Every other Claude model from 4.6 on bills its full 1M window at standard rates.3
Claude: cache prices. A 5-minute write costs 1.25x base input, and a 1-hour write 2x. A read costs 0.1x on most models, and 0.05x on Opus 5.5 and Sonnet 5.5. On Sonnet 5.5 that is $2.50 and $4 for writes, $0.10 for a read. On Haiku 5.5, up to 100,000 tokens, it is $0.125 and $0.20 for writes, $0.01 for a read.3 Caching pays after one read for 5 minutes, or two reads for 1 hour.3 The cache is per model.11 A cache entry "only becomes available after the first response starts".6 Agent loops read "a median 84%" of their input from the cache. "Below about 80%, look for something breaking the cache."8
Claude: effort and the cache. Changing top-level effort "can invalidate all or part of the prompt cache".4 A per-message effort change, in beta behind mid-conversation-output-config-2026-07-01, keeps the cached start.21 "Sweep two or three effort levels ... each in a separate session."8
Claude: max_tokens. On stop_reason: "max_tokens" there are two remedies. "If quality on those requests matters, raise the cap." And "if they were over-thought, lower the effort."5 Anthropic's advice is 64,000 for agentic work, and "lowering it does not make the model economize".8
Claude: batches. Half the standard price on input and output: Sonnet 5.5 $1 / $5, Haiku 5.5 $0.05 / $0.25.3 Up to 100,000 requests or 256 MB a batch. Most finish within 1 hour. Requests not processed in 24 hours expire. Results are kept 29 days.7 A result is succeeded, errored, canceled or expired, and only succeeded is billed.7 Cache hits in a batch are "best-effort", typically 30% to 98%, and the 1-hour cache is recommended.7
Claude: task budgets. Beta, header task-budgets-2026-03-13, a minimum of 20,000 tokens, and "a soft hint, not a hard cap".22
Claude: fast mode. Up to 2.5x more output tokens per second, at $8 / $40 on Opus 5.5. Not available with the Batch API.23
Claude: data residency. inference_geo: "us" multiplies every token price by 1.1.3
Claude: tokens. Claude 4.7 and later use a tokenizer that "produces approximately 30% more tokens for the same text". "Recount prompts against the model you plan to use."24 Token counting is free, and its count is an estimate.24
Claude: sampling. On API version 2026-10-21, sending temperature, top_p or top_k returns a 400 on any model, "even at the parameter's default value".25
Claude: lifecycle. A model is Active, Legacy, Deprecated or Retired, with "at least 60 days' notice before model retirement for publicly released models".9 Sonnet 5.5 retires not sooner than September 28, 2027, and Haiku 5.5 not sooner than October 7, 2027.2 On a pinned id, "the serving infrastructure ... can change over time", with "minor differences in observable behavior".1
Claude: usage reporting. The Usage and Cost Analytics API "typically refreshes within 4 hours ... can take up to 24 hours".10 The Agent SDK's total_cost_usd and costUSD fields are "client-side estimates, not authoritative billing data".26
OpenAI: other prices. gpt-6-astra $10 / $50, gpt-6.1-sol $2 / $10.12 Batch is half: gpt-6.2-sol $1 / $5. Fast costs 2x. Background requests on GPT-6.2 Astra and Sol, 6.1 Terra and 6 Luna cost 30% less for a 2-hour window and 40% less for an 8-hour one. Regional processing adds 10% for models released on or after March 5, 2026.12
OpenAI: reasoning. GPT-6.1 Sol, GPT-6 Sol and GPT-6 Luna default to medium. Reasoning tokens are billed as output.13
OpenAI: caching. Reads cost 0.05x input on GPT-6.2 Astra, GPT-6.2 Sol, GPT-6.1 Sol and GPT-6.1 Terra, and 0.1x on most others.14
OpenAI: batches. Output and error files expire 30 days after creation by default. Completed requests in an expired batch are billed.15
OpenCode: models and billing. Its catalog of models comes from models.dev, provider integrations and your config.16 Console responses report opencode.billing_source: free, balance, go, go-plus or byok.18
Check yourself
Question 1 / 7
0 answered
You port Chapter 25's stop-reason gate to OpenAI. Which response marks a cut answer there?
Sources
- Model IDs and versions, Anthropic, read November 30, 2026.↑↑2
- Models overview, Anthropic, read November 30, 2026.↑↑2↑3↑4↑5
- Pricing, Anthropic, read November 30, 2026.↑↑2↑3↑4↑5↑6
- Effort, Anthropic, read November 30, 2026.↑↑2↑3↑4
- Steering thinking and cost, Anthropic, read November 30, 2026.↑↑2↑3
- Prompt caching, Anthropic, read November 30, 2026.↑↑2↑3↑4↑5
- Batch processing, Anthropic, read November 30, 2026.↑↑2↑3↑4↑5↑6↑7
- Optimizing for cost and intelligence, Anthropic, read November 30, 2026.↑↑2↑3↑4↑5
- Model deprecations, Anthropic, read November 30, 2026.↑↑2
- Usage and Cost Analytics API, Anthropic, read November 30, 2026.↑↑2
- Cache diagnostics, Anthropic, read November 30, 2026.↑↑2
- Pricing, OpenAI, read November 30, 2026.↑↑2↑3↑4
- Reasoning models, OpenAI, read November 30, 2026.↑↑2↑3↑4
- Prompt caching, OpenAI, read November 30, 2026.↑↑2↑3↑4↑5
- Batch API, OpenAI, read November 30, 2026.↑↑2↑3
- Models, OpenCode, read November 30, 2026.↑↑2↑3↑4↑5
- Providers, OpenCode, read November 30, 2026.↑↑2
- Console API: inference, OpenCode, read November 30, 2026.↑↑2
- Zen, OpenCode, read November 30, 2026.↑
- Choosing a model, Anthropic, read November 30, 2026.↑
- Effort per message, Anthropic, read November 30, 2026.↑
- Task budgets, Anthropic, read November 30, 2026.↑
- Fast mode, Anthropic, read November 30, 2026.↑
- Token counting, Anthropic, read November 30, 2026.↑↑2
- Migrating to API version 2026-10-21, Anthropic, read November 30, 2026.↑
- Track cost and usage, Claude Agent SDK, Anthropic, read November 30, 2026.↑
- Owner
- Panaversity