Home / Blog / Generative AI & RAG

    LLM Cost Optimisation: Caching, Routing and Smaller Models

    By Softworth Solutions · · 4 min read · For readers in US, UK, UAE, India

    Coins, calculator and paperwork on a desk

    In short: The biggest LLM cost savings usually come from trimming prompts, using your provider's prompt caching, routing simple requests to smaller models and caching answers to repeated questions. Measure quality before and after each change, and leave fine-tuning or self-hosting until you understand your usage.

    LLM bills have a habit of creeping up quietly. A longer system prompt here, an extra retrieval chunk there, a chat history that's never trimmed, and suddenly the monthly invoice has doubled. The good news is that most of that spend is avoidable.

    Where does LLM spend actually go?

    Usually to a few features or a few heavy users. Log input tokens, output tokens, model and cost for every call, tagged by feature and customer, before changing anything. Output tokens are typically priced several times higher than input tokens, so verbose answers cost more than they look. Set a quality baseline with a test set of real requests too, so every optimisation can be checked against it.

    Then trim. Cap conversation history, retrieve fewer and better chunks, strip boilerplate from system prompts, ask for concise answers and only send the tool definitions an agent needs right now.

    How does prompt caching cut costs?

    Prompt caching lets a provider reuse its processing of an identical prompt prefix, such as a long system prompt, tool definitions or a reference document, and charge less for that portion. Some providers apply it automatically above a minimum length; others need explicit cache markers.

    To benefit, put stable content first and the user's question last. Avoid timestamps or request IDs at the top of a prompt, which silently break the cache. For chat apps and agents that resend long context every turn, this is often the single largest saving.

    Key facts

    • Anthropic introduced prompt caching for Claude in 2024, charging cached prompt reads at a fraction of the normal input token price. (Anthropic)
    • OpenAI applies prompt caching automatically to eligible prompts above a minimum length, discounting the cached input tokens. (OpenAI)
    • OpenAI's Batch API processes asynchronous requests within 24 hours at a lower price than standard synchronous calls. (OpenAI Platform Docs)

    Which requests can go to smaller models?

    More than you'd think. Classification, extraction, short summaries, query rewriting and simple FAQ answers often work well on smaller, much cheaper models. A router decides which model handles each request.

    Common cost levers compared
    LeverEffortRisk to qualityBest for
    Prompt trimmingLowLow if testedEvery app
    Prompt cachingLowNoneLong system prompts, agents, chat
    Static model routingLow to mediumMedium; test per featureClassification, extraction
    Semantic response cacheMediumMedium to highRepeated FAQ-style questions
    Self-hosted open modelsHighVariesSteady, very high volume

    Start with static routing: assign each feature the cheapest model that passes its tests. Re-run those tests whenever providers release new models, because the cheapest acceptable option keeps changing. For when a smaller model is worth fine-tuning, see our post on fine-tuning small language models.

    An illustrative example

    Imagine a US-based HR tech startup with an Indian engineering team, running every request through its most capable model. A cost review shows most calls are simple: tagging résumés by role, extracting dates and summarising short notes. The team moves those to a small model after they pass the test set, restructures the system prompt so caching kicks in, and caps chat history. Complex reasoning stays on the large model. The bill drops sharply, and test scores barely move.

    Coins, calculator and paperwork on a desk

    Is self-hosting worth it in India, the UAE or the UK?

    Only at steady, high volume, or where data residency demands it. Self-hosting means paying for GPUs, scaling, monitoring and upgrades, and an idle GPU server is rarely cheaper than per-token pricing. UAE and Indian enterprises sometimes self-host for residency reasons; check what your hyperscaler offers in-region first. As a rule of thumb, an app spending around INR 2 lakh, USD 2,400, GBP 1,900 or AED 9,000 a month on APIs can justify a week or two of optimisation work.

    Key takeaways

    • Measure cost by feature and customer before optimising.
    • Restructure prompts so caching works: stable content first.
    • Route simple tasks to smaller models, feature by feature, with tests.
    • Treat self-hosting as a volume or residency decision, not a default.

    Softworth Solutions (SWS AI) runs focused cost reviews of LLM applications from our base in Coimbatore, India. If your AI bill is growing faster than your usage, send us your numbers.

    Frequently asked questions

    Will a smaller model reduce answer quality?

    It can, so test each feature against real requests before switching. For narrow tasks like classification and extraction, smaller models often perform almost as well at a fraction of the cost.

    What's the difference between prompt caching and response caching?

    Prompt caching is done by the provider and discounts a repeated prompt prefix while still generating a fresh answer. Response caching is done by your app and returns a stored answer without calling the model.

    Can UAE companies use these techniques with in-region hosting?

    Yes. Prompt trimming, routing and response caching work with any provider. Prompt caching and batch discounts depend on the provider and region, so check what's available on the cloud region you use.


    Planning an AI or software project? Talk to our team for a free consultation and an honest estimate.

    Previous: Digital Transformation for Coimbatore's Textile and Manufacturing SMEs
    Next: AI Trends Businesses Should Plan For in 2026

    Keep reading