PromptingAug 29, 2026·8 min read

Why Your LLM Features Cost Five Times More Than They Should

A startup was spending $44/mo in API tokens to serve users paying $29/mo. We profiled token telemetry, enabled prompt prefix caching, and cut inference costs by 81%.

#LLM Costs#Prompt Caching#Model Routing#Inference Economics#AI Engineering

01Run this check right now

Diagnostic Test

The Prompt-to-Completion Ratio Check

Inspect your LLM API response metadata. If your input prompt tokens exceed your output completion tokens by more than 20 to 1 on routine queries, your system is resending static context that could be cached or pruned.

grep -rnE "(usage|prompt_tokens|completion_tokens)" server/logs/ | awk '{print $NF}' | head -n 20

Findings from the Field

  • /01I profiled an AI copilot where users on a $29/mo subscription burned $44/mo in raw model tokens on OpenAI and Anthropic APIs.
  • /02The application was resending 8,400 tokens of static documentation on every conversational turn with zero caching.
  • /03Using flagship frontier models for simple classification or date extraction wastes 90% of token compute.
  • /04Enabling Anthropic prompt prefix caching slashed input token billing rates by 90% and cut turn latency by 3X.
  • /05Implementing a dynamic model router and Redis query cache dropped monthly inference costs from $4,800 to $920.

The inverted SaaS unit economics

A founder came to me with an uncomfortable spreadsheet. They had launched an AI-powered customer support copilot, charging customers $29 per month. In their first month of public usage, their OpenAI and Anthropic API bills totaled $4,800 for about 110 active customers.

A quick division showed the problem: each customer was consuming roughly $44 per month in raw model inference. Every new customer signing up was actively losing them $15 per month.

The founders were worried they had chosen the wrong business model. But when I looked into their telemetry logs, the problem was not user volume; it was the sheer waste of context transmission on every turn.

Where the tokens were going: 8,400 to 1

I pulled down 200 API request logs and looked at the token usage metadata. For an average user message like 'Where do I find my invoice?', the response from the model was 35 completion tokens.

The input prompt, however, was 8,420 tokens. On every single turn, the AI-generated backend was serializing the user's entire conversation history, 12 tool schemas, and their entire 18-page company policy manual into the prompt payload.

Multiply 8,400 tokens by 15 turns per conversation across 100 users every day, and you are burning hundreds of millions of prompt tokens on static, repetitive context.

The luxury limousine analogy

Think of it like taking a chauffeur-driven luxury limousine down to the end of your driveway to pick up the morning mail. The car will get the job done, but paying for a V12 engine and a driver to travel 40 feet across your lawn every morning is an expensive way to collect a postcard.

Fix 1: Enable prompt prefix caching

Modern frontier providers (like Anthropic and OpenAI) support prompt prefix caching. If your system instructions and documentation remain identical across calls, the provider can cache those tokens in GPU memory.

On Anthropic, cached prompt tokens cost 90% less and process up to 3X faster. But caching only activates if the static prefix sits at the very top of your prompt before any dynamic user text.

We restructured their prompt payloads to place the static reference docs in a cached system block:

Cache-optimized prompt structure (Anthropic)typescript
// Static context is cached in memory across all customer requests
const response = await anthropic.messages.create({
  model: "claude-3-5-sonnet-20241022",
  max_tokens: 1024,
  system: [
    {
      type: "text",
      text: staticDocumentationKnowledgeBase, // 6,500 tokens of static manuals
      cache_control: { type: "ephemeral" }, // Instructs Anthropic to cache this block
    },
  ],
  messages: [
    { role: "user", content: dynamicUserMessage }, // Dynamic message at the end
  ],
});

Fix 2: Implement dynamic model routing

The second issue was that the prototype routed every task to Claude 3.5 Sonnet. Categorizing an incoming message (e.g. deciding whether a ticket is about billing or technical bugs) does not require a flagship reasoning engine.

We added a lightweight router that sends classification and JSON extraction to Claude 3.5 Haiku or GPT-4o-mini, saving the flagship model for synthesis:

Dynamic model routertypescript
type TaskType = "classification" | "reasoning";

export function selectModelForTask(task: TaskType): string {
  if (task === "classification") {
    // 10X cheaper, responds in 180ms
    return "claude-3-5-haiku-20241022";
  }
  // Flagship reasoning for complex document synthesis
  return "claude-3-5-sonnet-20241022";
}

Fix 3: Redis semantic caching for deterministic questions

Finally, we noticed that 40% of user queries were identical: questions about password resets, refund policies, and API keys. We placed an in-memory Redis cache in front of the model router.

If a question matches a cached prompt hash, we serve the response directly from Redis in 4ms with zero API token cost.

Results: from $4,800 to $920

With prompt prefix caching, model routing, and Redis caching enabled, their monthly API invoice dropped from $4,800 to $920. Cost per user fell from $44/mo to $8.30/mo, turning a money-losing feature into a profitable 71% gross margin product.

LLM inference economics reward thoughtful caching and routing. Now that the bills are sane, time to grab a snack and get back to work, because yolo.

Production Hardening & Audits

Stuck on prompt regressions, leaked keys, or database scaling in an AI-built app? Explore our platform-specific teardowns:

Diagnostic & Rescue

1 business day reply

Think your prototype is vulnerable or hitting scale limits?

Send us a note with your repository, Supabase link, or project details. A senior engineer will review your policies and reply within one business day.