Blog › Token saving, part 1
How to cut your LLM API bill: 6 token-saving techniques with examples
Most LLM bills aren't high because the model is expensive. They're high because the same tokens get sent, generated and paid for again and again. Here are six fixes, each with a worked example, ordered roughly from biggest saving to smallest effort.
Part 1 of a series on spending less per token. All examples use Claude Sonnet 5.5 at Anthropic's list price ($2.00 input, $10.00 output per million tokens) unless noted.
First, where the money goes
You pay for three things on every call:
- Input tokens: your prompt, plus everything you send along with it: system prompt, tool definitions, documents and the whole conversation so far.
- Output tokens: what the model writes back. On Claude Sonnet 5.5 these cost 5× as much as input.
- Repeats: the API has no memory, so the context is sent again on every call. In agents and long chats this is usually the biggest line on the bill.
Every technique below attacks one of these.
1. Cache what you send on every call
If the start of your prompt is identical from call to call (system prompt, tool definitions, a long document), the provider can store it and charge a fraction of the input price when it's reused. On Claude Sonnet 5.5, a cache hit costs $0.10 per million tokens instead of $2.00, just 5% of the normal input price.
Example: a coding agent
50M input and 2M output tokens a month, a realistic month for one developer using an agent every day. Most of the input is the same repository context resent on every step, so 85% of it can come from cache.
| Setup | Monthly cost |
|---|---|
| No caching | $120.00 |
| 85% of input from cache | $39.25 −67% |
How to get high hit rates:
- Put everything stable first and everything that changes last. The cache only matches an exact prefix, so one changed character near the top invalidates the rest.
- Don't put timestamps, request IDs or shuffled tool lists at the top of the prompt.
- Check your usage data for cache read tokens. If they're a small share of input, your prefix is changing somewhere.
Writing to the cache costs a little more than normal input (1.25× for Anthropic's 5-minute cache), so the table above slightly flatters the result. Anthropic says caching pays for itself after a single cache read.
2. Send easy work to a small model
Classifying a ticket, extracting a date or rewriting a sentence doesn't need a frontier model. Claude Haiku 5.5 costs $0.10 input and $0.50 output, 20× cheaper than Claude Sonnet 5.5 per input token.
Example: a support bot
5M input and 1M output tokens a month. Most questions are simple, so 80% go to the small model and only the hard 20% go to the big one.
| Setup | Monthly cost |
|---|---|
| Everything on Claude Sonnet 5.5 | $20.00 |
| Everything on Claude Haiku 5.5 | $1.00 |
| 80% small model, 20% big model | $4.80 −76% |
The simplest router is a rule (short message, known intent: small model). A step up is letting the small model answer and escalating when it says it isn't sure. Test on real traffic before switching, since a cheap wrong answer can cost more than an expensive right one.
3. Ask for shorter answers
Output is the expensive side of the bill, and models are chatty by default: a friendly preamble, a recap of your question, a summary at the end.
Example: an app making 1,000 calls a day
Cutting the average answer from 800 to 300 tokens, by asking for the result only, changes a month's output from 24M to 9M tokens:
| Average answer | Monthly output cost |
|---|---|
| 800 tokens | $240.00 |
| 300 tokens | $90.00 −63% |
- Say exactly what you want back: "Return only the JSON", "Reply with the changed lines as a diff".
- Set
max_tokensas a safety net, not as the main control. A cut-off answer is often useless and gets retried. - For code, ask for edits instead of the whole file. Rewriting a 400-line file to change two lines is one of the most common wastes in coding tools.
4. Batch anything that can wait
Anthropic, OpenAI and Google all offer a batch API: you send many requests at once, get results within 24 hours, and pay half price. Evals, nightly reports, tagging a backlog and translating content rarely need an answer in seconds.
Example: a nightly job
20M input and 5M output tokens a month of overnight processing:
| Setup | Monthly cost |
|---|---|
| Real-time API | $90.00 |
| Batch API | $45.00 −50% |
On Anthropic, the batch discount stacks with prompt caching. Batch APIs usually run directly with the model maker, so check whether your gateway supports them before planning around it.
5. Stop resending the whole conversation
A chat app that sends the full history on every turn pays for the first message again on turn 2, turn 3 and every turn after.
Example: a 20-turn conversation, 500 tokens per turn
| Strategy | Input tokens over 20 turns |
|---|---|
| Resend full history every turn | 105,000 |
| Last 4 turns + a 300-token summary of the rest | 41,800 −60% |
- Keep recent turns word for word and summarise older ones.
- For documents, retrieve the relevant sections instead of pasting the whole file.
- Drop tool results once they've been used. A 5,000-token search result doesn't need to ride along for the rest of the session.
Trimming and caching pull in opposite directions: a summary that changes every turn breaks the cache. For agents with stable context, cache first; for long chats, trim first.
6. Pay less for the same tokens
The last lever needs no code changes: the same model costs different amounts depending on where you buy it. OpenRouter charges list price plus a 5.5% card fee. SayGM sells Claude Sonnet 5.5 at $1.03 input and $5.15 output, about half of list.
Example: the cached coding agent from technique 1
| Where you buy | Monthly cost |
|---|---|
| OpenRouter, incl. 5.5% fee | $41.41 |
| Anthropic list price | $39.25 |
| SayGM | $20.21 −51% vs OpenRouter |
Switching is a base URL and key change in the OpenAI, Anthropic or Gemini SDK. Prices for every model are in our comparison table. One honest caveat: on Claude, GPT and Gemini, the model maker still processes your prompts whichever gateway you use, so keep secrets and client data on direct or sealed routes.
Disclosure: we earn a reward if you sign up to SayGM through our links. Your price is the same.
Putting it together
The techniques stack. Taking the coding agent from $120.00 a month: caching brings it to $39.25, and buying the same tokens through SayGM brings it to $20.21. That's 83% less for the same model doing the same work, before routing, shorter outputs or trimming are even applied.
Today
Move stable content to the top of prompts. Ask for shorter answers. Compare your per-token price.
This week
Check cache hit rates in your usage data. Move overnight jobs to a batch API.
This month
Route simple requests to a small model. Summarise long conversations instead of resending them.
Next in this series
- Part 2: We audited GPT Researcher's LLM calls: a real caching miss, and how to structure prompts so the cache actually hits.
- Part 3: Model routing: deciding which requests need the big model.
- Part 4: Measuring cost per task, so you know which change worked.
Sources: Anthropic pricing (cache and batch rates), SayGM prices, OpenRouter platform fee. Dollar figures are recalculated from current prices each time the site updates; token counts in the examples are illustrative.