1. Foundations: Pricing, Tokens and Cost Drivers
8 entriesUnderstand what you pay for before optimising. Cost is roughly tokens in plus tokens out, multiplied by the model's price, multiplied by the number of calls. Every technique below reduces one of those three.
2. Smaller Models, Multi-Model Routing and Query Classification
9 entriesUse the cheapest model that can do the job and route by difficulty. Reserve large models for coding, planning and complex reasoning; send FAQs, classification and extraction to smaller ones.
3. Context Trimming, Summarization and RAG
9 entriesSend only what the model needs. Cutting a 20k-token conversation to the 2k relevant tokens can reduce input cost dramatically.
4. Output Limits and Structured Outputs
7 entriesControl response length and format. Fewer output tokens cost less, and structured output reduces retries and parsing failures.
5. Response, Prompt and Semantic Caching
9 entriesPay once for repeated work. Exact caches return stored answers, prompt caches discount repeated prefixes, and semantic caches match by meaning.
6. Batch Processing and Tool-First Architecture
6 entriesGroup work and use deterministic tools before calling an LLM. Batch APIs offer discounts for non-urgent jobs, and a clock, calculator or SQL query is cheaper and more accurate than a model.
7. Agent Guardrails: Iterations, Tool Calls, Tokens and Timeouts
5 entriesAgents are often the largest source of AI spend, so cap them. Set maximum iterations, tool calls, tokens and wall-clock time, and stop loops early.
8. Cost Monitoring, Observability and FinOps
8 entriesTrack cost per user, request, token, cache hit and agent. Watch daily spend, cost spikes, expensive prompts, users and agents, and set budgets and alerts.
9. Self-Hosted Inference Savings
9 entriesLower unit cost when you run models yourself. Quantization, speculative decoding and efficient engines raise throughput per GPU.
10. Related Pages on This Site
6 entriesDirectories for token optimization, FinOps and LLM operations. Where each part of an LLM cost programme is listed.
Related Pages
1 entriesRelated research directories on this site.
Frequently Asked Questions
What are the main LLM cost optimization techniques?
Fifteen common ones are: use smaller models, route requests across models, trim context, summarize conversation history, cap output tokens, use retrieval-augmented generation, cache responses, cache prompt prefixes, use semantic caching, request structured outputs, batch requests, set agent guardrails, call deterministic tools first, classify queries before processing and monitor cost with dashboards.
How do smaller models and multi-model routing save money?
Most FAQ, classification and extraction tasks work well on smaller models, so reserve large models for coding, planning and complex reasoning. A router sends each request to a model that matches its difficulty, for example sentiment analysis to a small model, SQL generation to a medium one and coding to a large one. Research such as FrugalGPT and RouteLLM reports large savings, but results depend on your tasks, so evaluate on your own data.
How do context trimming and summarization reduce cost?
Input tokens are billed on every call, so sending only relevant messages, removing duplicates and replacing old history with a short summary of key facts, preferences and decisions can cut a 20,000-token prompt to a few thousand. Check answer quality after trimming, because dropped context can cause errors.
What is the difference between response, prompt and semantic caching?
Response caching returns a stored answer when the same question repeats. Prompt caching lets the provider reuse repeated prompt prefixes such as system prompts and documents at a discount. Semantic caching matches questions by meaning, so "What is OAuth?" and "Explain OAuth" can share one answer, at the risk of returning a near match that is wrong.
Why use structured outputs and output limits?
Short, structured responses use fewer output tokens, are easier to parse and cause fewer retries. Set max tokens, ask for concise formats such as three bullets, and use schema-constrained JSON where the provider supports it.
When should I use batch processing?
Batch APIs from providers such as OpenAI, Anthropic, Google and Amazon Bedrock process non-urgent jobs asynchronously, often at a discount, which suits classification, extraction, tagging and data enrichment. Check each provider current terms for the discount and turnaround.
Why are agents the biggest cost risk and how do I control them?
Agents loop, call tools and re-send growing context, so spend can climb quickly. Set limits on iterations, tool calls, tokens and timeouts, stop loops early and put budgets at a gateway. OWASP lists unbounded consumption as an LLM risk.
What does a tool-first architecture mean?
Use deterministic tools before calling a model: a clock API for time, a weather API for weather, a calculator or API for currency conversion, and SQL for database lookups. Use the LLM only when reasoning is required, which cuts cost and errors.
What should I monitor?
Track cost per user, cost per request, tokens per request, cache hit rate, model usage and agent cost, plus daily spend, spikes, and the most expensive prompts, users and agents. Tools such as Langfuse, Helicone and LiteLLM, and OpenTelemetry GenAI conventions, help collect this data.
How current is this list?
Links were checked in November 2026. Some sites block automated checks and may need a manual click. Provider prices and discounts change often, so confirm them on the provider pricing pages. This page is a resource list, not financial advice.