To reduce LLM API costs, send fewer tokens, send them to a cheaper model or tier when quality allows, and stop paying full price for work nobody is waiting on. OpenAI’s cost guide lists three levers: fewer requests, fewer tokens and a smaller model, then adds batch, background and flex options for workloads that can wait. Anthropic and Google document similar levers under different names. Each section below says what the providers’ docs state and what the docs warn about.

Where the tokens go

Cost is tokens times price, so find the biggest token source first. Anthropic advises tracking token consumption to find optimization opportunities. In a trace, the usage fields on each model call show input, cached input, output and reasoning tokens per step, which LLM tracing records as span attributes.

The same text can cost a different number of tokens on a different model. Anthropic says Claude 4.7 and later models use a newer tokenizer that produces approximately 30 percent more tokens for the same text than earlier models, and tells readers to count tokens with the specific model ID before comparing.

The levers at a glance

LeverWhat it changesMain risk the docs state
Prompt cachingInput price of a repeated prefixMisses when the prefix changes. See prompt caching
Batch API50% off, 24-hour windowResults are not immediate
Flex or background tiersDiscount, synchronous or queuedSlower responses and capacity errors
Smaller modelPer-token priceLower capability on hard cases
Lower reasoning effortReasoning tokens billed as outputCapability drops on hard tasks
Shorter outputOutput tokensA hard cap can truncate the answer
Trimmed contextInput tokensCleared content is gone
No model callThe whole requestOnly where the answer is already known

Wait-tolerant tiers compared

Three providers offer a discount for work that does not need an immediate answer. The figures below are as the docs stated them in November 2026.

OpenAIAnthropicGemini
Batch discountOpenAI documents 50% off with completion within 24 hoursAnthropic documents 50 percent off, with most batches finishing in less than 1 hourGoogle documents 50% of standard cost with a 24-hour target
Discounted synchronous or queued tierFlex, priced at Batch rates, and background windows at 30% (2 hours) or 40% (8 hours) below Standard, per OpenAINo flex or background tier on the pricing and batch pagesFlex at 50% off, in preview, with a 1 to 15 minute latency target, per Google
Premium tier for speedFast and Ultrafast modes charge a premiumFast mode is priced at a premium for supported models (Claude Fable 5.2 and some Opus models) and is not available with the Batch APIPriority is listed at 75-100% more than Standard

What the docs warn about:

  • OpenAI Batch. Each input file can only include requests to a single model, and a batch can hold up to 50,000 requests. Batch jobs do not count toward standard per-model rate limits. On expiry, completed requests are still charged.
  • OpenAI Flex. OpenAI says it is winding down the Flex beta: Flex is unavailable on GPT-6.2 Astra and GPT-6.2 Sol and will not be added to future models, and background mode is the alternative for asynchronous work. A 429 Resource Unavailable response is not charged, and the retry options are backoff or a retry on standard processing.
  • Anthropic Batch. Batches expire if processing does not finish within 24 hours, and batch requests are not eligible for zero data retention. Results are kept for 29 days.
  • Gemini Flex. Google states that Flex traffic counts toward general rate limits, can be preempted, and has no server-side fallback to Standard, so the client needs its own retries and timeouts of 10 minutes or more.
  • Gemini Batch. Creating a batch job is not idempotent, so sending the same creation request twice creates two jobs.

OpenAI names running evaluations and classifying large datasets as Batch use cases, and Google lists “LLM-as-a-judge” regression tests among the offline jobs for Flex. See LLM-as-a-judge.

Combining batch with caching

Caching and batch discounts do not always add up the same way. Anthropic says they can be combined, but because requests run concurrently and in any order, cache hits are best-effort, and it reports typical hit rates from 30 percent to 98 percent depending on traffic. Google says a cache hit inside a batch is billed at the standard context caching rate.

Use a smaller model where it holds up

Anthropic suggests Haiku for simple tasks, Sonnet for most production workloads and Opus for the most complex reasoning. OpenAI advises choosing a model using examples from your workload and keeping the fastest configuration that meets your quality target, including on difficult cases.

The price spread is large. On November 30, 2026, Anthropic listed base input at $0.10 per million tokens for Claude Haiku 5.5, $2 for Claude Sonnet 5.5, $4 for Claude Opus 5.5 and $8 for Claude Fable 5.2, with output at $0.50, $10, $20 and $40 per million (Haiku 5.5 prompts over 100,000 tokens cost more). Check the live pricing page before relying on any of these.

Spend fewer reasoning tokens

Reasoning models bill their thinking as output. Google states that response pricing is the sum of output and thinking tokens, based on the full thoughts even though only a summary is returned.

Each provider has a dial:

  • OpenAI. For routine extraction or classification, OpenAI suggests a lower supported reasoning.effort, and a lower text.verbosity for shorter answers. The usage.output_tokens_details.reasoning_tokens field shows how much reasoning a call used.
  • Anthropic. The output_config.effort parameter trades thoroughness against token efficiency on a single model. Its low level is described as the most efficient, with significant token savings and some capability reduction. Anthropic recommends an effort sweep on your own evals rather than carrying settings over from another model.
  • Gemini. Google advises minimal thinking for simple tasks such as fact retrieval or classification, and lower thinking_level to cut cost or latency.

Cap output without truncating it

A cap that is too low can waste the spend. OpenAI warns that max_output_tokens caps reasoning and visible output together, so a low cap can leave the response incomplete before any visible text. Google notes that a response that hits the limit while reasoning is still billed for the thinking tokens generated, and says to lower thinking_level instead of setting a small max_output_tokens. Anthropic says thinking counts toward max_tokens even when it is not returned, and that effort barely changes how long replies are, so reply length is a prompt matter.

To shorten the visible answer, OpenAI recommends asking for the detail the user needs and requesting only the fields the application consumes. It also advises computing values already known, such as a message count, in application code. OpenAI also points to Structured Outputs for responses that must follow a schema.

Trim the context

Input tokens are paid on every turn of a conversation. OpenAI advises filtering search results for relevance, stripping unneeded markup and sending only the context required to answer accurately. See context engineering for how to decide what goes in, and tool calling for tool result size.

For long agent runs, Anthropic offers context editing, which clears specific content from history as it grows. Tool result clearing is described as best for agentic workflows with heavy tool use where old tool results are no longer needed. The docs say context editing is in beta and that server-side compaction is the primary strategy for long-running conversations. They list tasks requiring precise recall of early conversation details as a less ideal use case for context editing.

Skip the model call

OpenAI’s latency guide lists “Don’t default to an LLM” as a principle: use application code when the answer is already known, such as rendering an order status from an API or confirming a refund with a template. It also says to make fewer requests by combining steps when one request has everything it needs.

Check quality after every change

Every lever above trades something for the discount. Run the same examples before and after each change, and compare cost per completed task rather than cost per call, since a retry or a truncated answer adds a second call. OpenAI recommends recording input, cached input and output tokens alongside timings, grouped by model, service tier and task.