Guide

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.

Token spend levers, when they apply and what they need on FastRouter
LeverApplies whenTrade-offWhat you set on FastRouter
Prompt cachingRequests repeat a long prefix such as a system prompt, retrieved context or documentsOnly the repeated prefix is discounted, and only past a per-model minimum sizeNothing on providers that cache automatically; cache_control markers for Anthropic Claude
Response cachingIdentical or similar requests recur and the same answer is acceptableA hit returns a stored answer, not a new oneA cache_key header, plus an optional cache object
Prompt compressionPrompts carry long schemas, retrieved context or conversation historyOnly the default engine is losslessAn optimize block with a compress object in the request body
Flex pricingWork tolerates variable throughput, on select OpenAI and Google modelsHigher tail latency during peak provider loadThe :flex suffix on the model ID
Batch processingHigh-volume chat completion or embedding work can finish within 24 hoursResults arrive later as a file, not inlineA 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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
FAQ

Common questions

Yes. They cut cost at different points. Prompt compression shrinks the input tokens sent on each request, prompt caching bills repeated context at a discounted rate, and response caching skips the model call for repeated requests. In FastRouter, content marked with cache_control is always left untouched by compression.

No. In FastRouter, compression is off by default, enabled per request, and fails open. If the compression service is unreachable, times out or errors, or the result fails validation, the original messages are sent unchanged.

No. Flex requests can experience higher tail latencies during peak provider load, so interactive, latency-sensitive and SLA-bound workloads should stay on the standard tier. Flex fits extraction, classification, batch summarization, evals and scheduled background jobs.

No. Every FastRouter plan, including the free Starter plan, passes through model costs with $0 markup. The plan price covers the platform, not a margin on top of the underlying provider token prices.

Try it on your own traffic

Point your existing OpenAI-compatible client at FastRouter and send a request. Free to start, no credit card required.