How do you cut LLM token spend without rewriting your application?
You cut LLM token spend without rewriting your application by applying cost controls at the gateway or in request settings, instead of rewriting prompts or business logic. The main levers are caching repeated context, caching whole responses, compressing prompts and moving work that can wait to discounted or asynchronous tiers. Most of them need only a request-level setting such as a header, a model suffix or an extra request field; batch processing uses a separate asynchronous API. Measure where the spend goes first, then apply the levers that match your traffic.
Last updated
Key facts
- The levers are prompt caching, response caching, prompt compression, discounted processing tiers and batch processing.
- Each lever applies to a different traffic pattern, so measuring comes before enabling.
- On FastRouter, prompt caching is automatic on several providers; the other levers are opt-in.
- FastRouter Insights analyzes traffic weekly and is read-only: it recommends changes and never edits a request.
- FastRouter passes through model costs with $0 markup on every plan.
What does cutting spend without rewriting your application mean?
It means lowering the bill through configuration rather than by rewriting prompts, changing features or restructuring the application. The savings come from paying less for tokens you already send, sending fewer tokens for the same content, or not calling the model when a stored answer will do.
Token spend is input tokens and output tokens multiplied by their prices. Spend is often higher than necessary because the same context is reprocessed on every request, the same questions are answered more than once, or work that could wait is run at the standard real-time rate.
Which levers reduce token spend, and when does each apply?
Five levers cover most cases. Prompt caching and prompt compression reduce the cost of input. Response caching removes repeated calls. Flex processing and batch processing move work that does not need an immediate answer onto separate pricing tiers. Each one fits a specific traffic pattern and has its own trade-off.
| Lever | Applies when | Trade-off | What you set on FastRouter |
|---|---|---|---|
| Prompt caching | Requests repeat a long prefix such as a system prompt, retrieved context or documents | Only the repeated prefix is discounted, and only past a per-model minimum size | Nothing on providers that cache automatically; cache_control markers for Anthropic Claude |
| Response caching | Identical or similar requests recur and the same answer is acceptable | A hit returns a stored answer, not a new one | A cache_key header, plus an optional cache object |
| Prompt compression | Prompts carry long schemas, retrieved context or conversation history | Only the default engine is lossless | An optimize block with a compress object in the request body |
| Flex pricing | Work tolerates variable throughput, on select OpenAI and Google models | Higher tail latency during peak provider load | The :flex suffix on the model ID |
| Batch processing | High-volume chat completion or embedding work can finish within 24 hours | Results arrive later as a file, not inline | A JSONL file submitted in the dashboard or through the Batch API |
In what order should you apply the levers with FastRouter?
Start with measurement, then apply the levers from least to most intrusive: prompt caching first, because it leaves requests and outputs unchanged, then response caching and prompt compression, which are opt-in per request, and finally Flex and batch processing for work that can wait. Insights runs again each week, so the list can be reviewed regularly.
- Measure where the spend goes. Read the weekly recommendations in Insights. Free insights cover prompt caching and Flex tier, run automatically, and appear once a Key and Model scope has passed 1,000 text-generation requests in the previous 7 days. The analysis is read-only.
- Let prompt caching cover repeated context. Keep large static content at the start of the prompt. Prompt caching is automatic on OpenAI, DeepSeek, Google AI Studio, Google Vertex AI, Grok, Moonshot AI and Baseten; Anthropic Claude needs cache_control markers. A cached_tokens value above 0 in prompt_tokens_details confirms cache hits.
- Cache repeated responses. Send a cache_key header on requests whose answers can be reused. Response caching then serves identical and similar requests from FastRouter's gateway cache. A similarity_threshold of 1.0 limits matches to identical requests; the default is 0.75.
- Audit prompt compression, then enable it. Add an optimize block with a compress object and set mode to audit. Audit mode reports potential savings in response headers without modifying the request. If the numbers justify it, enable prompt compression, starting with the lossless default engine, headroom.
- Move work that can wait to Flex or batch. Append :flex to a supported model ID for background jobs such as extraction, classification and evals, and keep real-time, user-facing traffic on the standard tier. For bulk chat completion or embedding work, submit a JSONL file through batch processing.
What does each lever save on FastRouter?
The saving depends on the lever, the model and the provider, and FastRouter's own pages state it differently for each. Caching has published billing multipliers, Flex pricing varies per model, compression savings are reported per response, and batch work is billed at each model's batch pricing.
- Prompt caching: cached context is billed as low as 0.10× the normal input price on supported providers.
- Response caching: cache hits are billed at 0.1× standard token pricing and cache storage is free. It is included from the Pro plan.
- Prompt compression: no fixed figure. Each compressed response reports its savings in the X-FastRouter-Tokens-Saved and X-FastRouter-Savings-Percent headers.
- Flex pricing: around 50% on some models, with savings that vary per model and provider.
- Batch processing: requests are billed at the batch pricing for the underlying model, which is listed on the individual model pages.
Sources
Where the statements about FastRouter on this page come from.