FUTURE PROOF MARKETER

Artificial IntelligenceMarketing

LLM Cost Optimization: Eleven Ways to Reduce Your OpenAI and Claude API Costs, in Order of Effort

Illustration for: LLM Cost Optimization: Eleven Ways to Reduce Your OpenAI and Claude API Costs, in Order of Effort

Some links below are affiliate links: if you buy through them we may earn a commission at no extra cost to you. It funds the testing budget and never changes a verdict — affiliate policy.

LLM cost optimization comes down to four big levers and seven smaller ones. The big four: use the smallest model that passes for routine work, keep your prompt's fixed part stable so prompt caching bills it at a tenth of the input price or less, cap how much the model writes, and send anything that can wait through the Batch API at half price. Before any of them, measure where the money goes and set a spend cap. After them come trimming history, fewer tool definitions, lower effort settings, and a gateway that removes exact repeats and duplicated content. In the worked example below, those steps take one workload from $1,200 to $124 a month.

Every price here comes from the providers' own pricing pages, checked 23 September 2026, and matches our AI API cost calculator, which runs the same list. Put your own numbers in it as you read.

Why the bill is higher than you expect

Three facts explain most "API bill too high" moments.

Output costs five times more than input. On every current Anthropic and OpenAI model we list, the output price is five times the input price (Claude Sonnet 5: $2 in, $10 out per million tokens). A model that writes three paragraphs where one would do is spending your money on the expensive meter.

Input grows with every turn. A chat or an agent resends the whole conversation on every request: system prompt, tool definitions, every earlier message and every tool result. Late in a long session a one-line question carries the whole session with it. Our Claude Code rate limit guide and the Codex token cost section show what that looks like for coding agents.

Thinking is billed as output. OpenAI's reasoning guide says reasoning tokens are invisible in the API but still "billed as output tokens". Anthropic's effort setting governs thinking, text and tool calls alike. A model that thinks hard about an easy question costs you a hard question's price.

The eleven levers, in order of effort

Ordered by how much work each takes. The two gateway levers sit at the end not because they are hard (they take one change of address) but because they only pay on particular kinds of traffic.

1. Measure first (minutes)

You cannot cut what you have not located. Open your provider's usage page and answer three questions: which model spends the most, what share of input is billed as cached, and which key or project caused the biggest day. Every API response also carries a usage object with input, output and cached token counts; log it.

Anthropic's token counting endpoint is free (rate-limited, not billed) and counts a request including system prompt, tools, images and PDFs before you send it. Use it before switching models: Anthropic says Claude 4.7 and later models use a newer tokenizer that produces roughly 30% more tokens for the same text, so a prompt counted on Haiku 4.5 is not the same count on Sonnet 5.

If your tools do not give you a per-request view, a gateway does. We run ours through Constellation Gate AI, whose free plan logs cost and tokens for 20,000 requests a month. Affiliate link: we earn a commission on Pro seats at no cost to you, and it pays for the testing, not the verdict.

2. Set a spend cap and an alert (minutes)

This does not lower the average bill. It removes the worst one. OpenAI lets you set organisation and project spend limits, with alerts at thresholds you choose; an alert only notifies, a hard limit stops requests. Anthropic's Console has an organisation spend limit under Settings, Billing and a monthly limit per workspace; requests over the limit return an error until the month resets or you raise it. Set the alert at the level where you would want to look, and the cap where you would want it to stop.

3. Match the model to the job (an hour)

The largest single lever, and the one people skip because the flagship is the default. Per million tokens, checked 23 September 2026:

ModelInputOutput
Claude Opus 5.5$4$20
Claude Sonnet 5$2$10
Claude Haiku 4.5$1$5
GPT-6 Astra$10$50
GPT-6 Sol$2$10
GPT-6 Luna$0.10$0.50

Moving from Opus 5.5 to Sonnet 5 halves the price per token; from Sonnet 5 to Haiku 4.5 halves it again. On OpenAI, Sol to Luna is a factor of twenty. Anthropic's own advice is Haiku for simple tasks, Sonnet for most production work, Opus for the most complex reasoning.

The practical form is routing: classification, extraction, tagging, short replies and subagents on the small model; the flagship only for the step that fails without it. Test on twenty real inputs before switching, not on a demo prompt.

4. Lower the effort or reasoning setting (one parameter)

Both providers let you tell the model how hard to work. Anthropic's output_config.effort runs from low to max and affects every output token, including thinking and tool calls; lower effort also means "fewer and terser tool calls". Most Claude models default to high; Opus 5.5 defaults to medium. OpenAI's reasoning.effort runs from none to max (Astra does not accept none).

Run the simple half of your workload at low and compare results. One catch on Anthropic: changing the top-level effort between requests restarts the prompt cache, so pick a level per workload rather than per turn, unless your model supports the per-message effort beta.

5. Cap the output (minutes)

Set max_tokens (Anthropic) or max_output_tokens (OpenAI), and say what you want: "five bullet points, no preamble", "JSON with these three fields". A length instruction does most of the work; the cap stops the outliers. Leave room when thinking is on: OpenAI suggests reserving at least 25,000 tokens for reasoning and output while you experiment, because a response cut off mid-thought is billed and useless.

6. Turn on prompt caching (an hour)

Prompt caching bills the repeated start of a prompt at a fraction of the input price: 0.1x on most models, 0.05x on Claude Opus 5.5, 0.025x on Claude Fable 5.1. On Anthropic it is one top-level cache_control field; on OpenAI it is automatic from 1,024 tokens. The one rule is order: fixed parts first (tools, system prompt, reference documents), changing parts last. A timestamp at the top breaks it silently.

We covered the three kinds of caching, the lifetimes and the break-even point in our LLM caching explainer; read that before tuning.

7. Batch what can wait (an afternoon)

All three big providers publish a batch rate at 50% of standard, on input and output:

  • OpenAI Batch API: 50% off, results within 24 hours "and often more quickly", on a separate rate-limit pool.
  • Anthropic Message Batches: 50% off, up to 100,000 requests per batch, "most batches completing within 1 hour", expired after 24 hours. Anthropic says batch and caching discounts stack, and suggests the one-hour cache for batches with shared context.
  • Gemini Batch API: 50% of standard cost, 24-hour target turnaround.

Good candidates: overnight reports, content tagging, evaluations, summaries of last week's tickets. OpenAI also offers Flex processing (service_tier: "flex") at Batch prices on ordinary requests, slower and sometimes unavailable, but in beta on a limited set of models; on the day we checked, its pricing page did not list the GPT-6 family.

8. Trim context and history (a day, then a habit)

Every token you resend is paid for again. Start a fresh conversation when the task changes (/clear in Claude Code, /new in Codex). Summarise long histories instead of carrying them. Retrieve the relevant section of a document instead of pasting the whole thing. Keep standing instruction files such as CLAUDE.md or AGENTS.md short, because they ride along on every request.

9. Fewer tool definitions, capped tool output (a day)

Tool definitions are input tokens on every request. Anthropic's pricing page lists a tool-use system prompt of 286 to 496 tokens per request, before your own tool schemas, and a browser-use toolset at about 6,600 tokens. Disconnect MCP servers you are not using. Then cap what tools return: Anthropic's web fetch tool takes max_content_tokens, Codex takes output_token_limit per MCP tool, and a search tool that returns four thousand tokens of JSON on every call is the most common silent cost we see.

10. Cache exact repeats (a gateway setting)

Exact-match response caching returns a stored answer when the identical request arrives again, so the provider is never called: 100% of the tokens saved on a hit. It pays on retries, scheduled checks, test runs and pipelines rerun on unchanged input. It does nothing for a live chat, where no two requests match. It is exact-match, not semantic; the explainer covers why that distinction matters.

11. Remove duplicated content losslessly (a gateway setting)

Agents resend what they already sent: the file they read two turns ago, the same tool schemas, terminal colour codes, the same log line four hundred times. A compressing gateway removes the repeats before forwarding; our prompt compression explainer covers why lossless beats lossy here. That is lever eleven, and it is where Gate comes in; the section below explains what it does and where it does not help.

The levers at a glance

#LeverEffortTypical saving (where documented)
1Measure firstMinutesNone directly; finds the other ten
2Spend cap and alertMinutesCaps the worst case, not the average
3Smaller model for routine workAn hour50% Opus 5.5 to Sonnet 5; 75% Opus 5.5 to Haiku 4.5; 95% Sol to Luna
4Lower effort / reasoningOne parameterFewer thinking and output tokens; varies, test it
5Cap outputMinutesProportional to output cut; output is 5x input price
6Prompt cachingAn hour90% on cached input (95% Opus 5.5, 97.5% Fable 5.1)
7Batch APIAn afternoon50% on input and output (OpenAI, Anthropic, Gemini)
8Trim context and historyA day, then habitDepends on session length
9Fewer tools, capped tool outputA dayTool schemas and results on every request
10Exact-match response cachingGateway setting100% on a hit; only on true repeats
11Lossless compressionGateway setting20%+ on agent workloads (vendor figure)

Provider figures checked 23 September 2026 on Anthropic's, OpenAI's and Google's documentation.

A worked example with today's prices

A content pipeline: 1,000 requests a day, 30,000 a month. Each request carries a 5,000-token fixed prefix (instructions, brand guide, examples) and a 1,000-token item to process, and returns 800 tokens. We hold token counts equal across models for simplicity; in practice Sonnet 5 and Opus 5.5 count the same text as roughly 30% more tokens than Haiku 4.5, which widens the gaps below.

StepOpus 5.5Sonnet 5Haiku 4.5
Baseline (180M input, 24M output)$1,200$600$300
+ prompt caching on the 5,000-token prefix$645$337.50$168.75
+ output capped at 500 tokens$465$247.50$123.75
+ Batch API (50%)$232.50$123.75$61.88

The caching line assumes the cache goes cold twenty times a day and is rewritten at the five-minute write price (Opus 5.5 $5, Sonnet 5 $2.50, Haiku 4.5 $1.25 per million). The prefix clears every model's caching minimum, including Haiku 4.5's 4,096 tokens. The batch line is the best case: cache hits inside a batch are less predictable.

Read the table two ways. Down a column, the free levers take Sonnet 5 from $600 to $124, about 79% less. Across a row, the model choice alone halves the bill at each step.

On OpenAI, GPT-6 Sol has the same list prices as Sonnet 5 ($2 in, $0.20 cached, $10 out), so the Sonnet column carries over. GPT-6 Luna would run the baseline for $30 a month, if it passes your quality test.

What a gateway adds here is small, and we would rather say so. This pipeline sends different items each time, so compression finds little to remove. If 5% of requests are reruns of an unchanged item, an exact-match cache takes 5% off. Gateways earn their keep on agents.

Where Gate fits: paying for the same file forty times

Every turn, a coding agent resends the whole conversation and re-reads the file it just edited. You pay for all of it. Prompt caching makes the repeated prefix cheap, but anything after the first change, and every duplicate inside it, is billed again.

Constellation Gate AI calls itself "the accountability layer for AI" and sits "between your agent and the model". Its compression is lossless: repeated content becomes a pointer to the first copy, tool schemas are minified, terminal control codes are removed, duplicate log lines collapse, harness scaffolding is trimmed and overlapping file reads become diffs. Gate's published figure is 20% or more fewer tokens on agent workloads, and 23% lower token cost in its Rocket Resume case study, on about $40,000 a month of spend. Both are vendor figures; our own field-test numbers follow on 30 September 2026.

Three things make it a lever rather than a gamble:

  • It keeps provider caching working. Gate says the prefix it forwards stays byte-identical across turns, so lever six and lever eleven stack instead of fighting.
  • It does lever ten too: exact-match response caching, "100% of tokens saved on a cache hit", with a duration you set.
  • It does not change your price per token. You pay at the provider's price, or bring your own key. On Pro, spend, token and rate limits apply per organisation, member or key, which is lever two for every agent at once.

Where it does not help: a single short chat has little to deduplicate, and on a flat Claude or ChatGPT subscription fewer tokens do not lower the bill. They make the same allowance last longer, which is what our Claude Code rate limit guide covers. Setup is one change of address for Claude Code or Codex; our Gate review has the detail and the trade-offs. Comparing gateways first? Our LLM gateway comparison and OpenRouter alternatives list fees and caching per product.

Your first fifteen minutes

Following the rule we apply to every tool: real input, one output, hard stop.

  1. Minutes 0 to 4. Open your provider's usage page. Write down last month's spend, the top model by cost, and cached input as a share of total input.
  2. Minutes 4 to 7. Set a spend alert at 80% of last month and a hard limit where you would want it to stop.
  3. Minutes 7 to 12. Pick the single most expensive workload. Ask one question of it: could a smaller model, a shorter answer or a batch run do this? Change one of the three.
  4. Minutes 12 to 15. Put the before and after into the cost calculator and write the monthly difference next to today's date. Stop.

If most of your spend is agents, add a fifth step next week: route one agent through Gate and put its tokens-saved number next to that date.

The short version

Measure, cap, then pay less per token (smaller model, caching, batch) and send fewer tokens (shorter output, lower effort, trimmed history, fewer tools). The first seven levers are free and live in your provider's settings. The last two need a gateway and pay on agents and repeats.

Gate covers those two, plus the per-key caps. Free records, Pro blocks: the free plan ($0, 20,000 recorded requests a month) meters every request with basic compression; full compression, spend limits, prompt-injection blocking and redaction are Pro at $20 per user per month. Start free with Gate (affiliate link; we earn a commission on Pro seats).

Prices and features checked on 23 September 2026 on Anthropic's pricing, batch processing, effort and token counting pages, OpenAI's pricing, Batch, Flex processing, reasoning, cost optimization and spend limit pages, and Google's Gemini Batch API page. Gate's figures are vendor-published. If something above is out of date, tell us and we will fix it with a dated note.

Questions we actually get

How do I reduce OpenAI API costs?

Start with the model: on OpenAI's price list, checked 23 September 2026, GPT-6 Luna costs $0.10 per million input tokens against $2 for GPT-6 Sol and $10 for GPT-6 Astra, so routing routine work down a tier is the largest single saving. Then keep the fixed part of your prompt at the front, because OpenAI's prompt caching is automatic and bills a cache hit at a tenth of the input price. Cap output with max_output_tokens and lower reasoning.effort, since reasoning tokens are billed as output. Anything that can wait goes through the Batch API at 50% off, with results within 24 hours. Set a project spend limit with an alert below it.

How do I reduce Claude API costs?

Use Haiku 4.5 ($1 input, $5 output per million tokens) or Sonnet 5 ($2 and $10) for work that does not need Opus 5.5 ($4 and $20). Switch on prompt caching with one top-level cache_control field: a cache hit costs 0.1x the input price, 0.05x on Opus 5.5. Set output_config.effort lower for simple tasks and cap max_tokens. The Message Batches API halves input and output, most batches finish within an hour, and Anthropic says the batch and caching discounts stack. Count tokens before you send with the free token counting endpoint, and set a workspace spend limit in the Console. Prices checked 23 September 2026.

What is ChatGPT API cost optimization?

It usually means cutting the bill for OpenAI's API (the per-token service developers and tools call), not the ChatGPT app. The ChatGPT subscription is a flat fee with usage limits, so nothing on this page lowers it; it only makes the allowance last longer. On the API, the levers are model choice, automatic prompt caching, shorter outputs, lower reasoning effort, the Batch API at half price, and fewer tokens per request.

How do I reduce LLM token usage?

Send less and ask for less. On the input side: clear or summarise old conversation history, retrieve the relevant section of a document instead of pasting all of it, connect only the tools a task needs, and cap what tools return. On the output side: set a max tokens limit, ask for the format and length you want, and lower the effort or reasoning setting so the model thinks less on easy tasks. Coding agents also resend files they have already read; a gateway with lossless compression removes those repeats.

What is token usage optimization?

Reducing the number of tokens a task consumes without making the result worse. It is one half of LLM cost optimization; the other half is paying less per token, through a cheaper model, prompt caching or batch pricing. Token optimization covers prompt length, conversation history, tool definitions and tool output, output length and reasoning depth. Measure it with the usage fields every API response returns, not by estimate.

My API bill is too high. What should I check first?

Three things, in this order. Which model is doing most of the spending, because a flagship left as the default is the most common cause. Whether cached input shows up in your usage at all, because a date or name at the start of a prompt quietly breaks prompt caching. And whether one key, agent or scheduled job accounts for a spike, because a loop does not know it is a loop. Your provider's usage page answers all three in a few minutes; then set a spend limit so the next spike stops at a number you chose.

FILED ON THE AI VIDEO & REPURPOSING SHELF — MORE FIELD-TESTED TOOLS AND GUIDES THERE →

#AI#Marketing Stack#Claude#ChatGPT#AI costs#productivity

Never miss a verdict

One tool tested, one workflow, one future signal, one deal — every week.

One email with the goods, then the weekly letter. Unsubscribe anytime.

Keep reading