<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: scorpion4ik26-lang</title>
    <description>The latest articles on DEV Community by scorpion4ik26-lang (@scorpion4ik26lang).</description>
    <link>https://dev.to/scorpion4ik26lang</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4188422%2F121e2f5c-cbf4-426f-b6ab-4a08818aa65f.png</url>
      <title>DEV Community: scorpion4ik26-lang</title>
      <link>https://dev.to/scorpion4ik26lang</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/scorpion4ik26lang"/>
    <language>en</language>
    <item>
      <title>Claude Haiku 5.5 vs Sonnet 5.5: Cost and Routing Guide</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Fri, 27 Nov 2026 14:00:37 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/claude-haiku-55-vs-sonnet-55-cost-and-routing-guide-fm4</link>
      <guid>https://dev.to/scorpion4ik26lang/claude-haiku-55-vs-sonnet-55-cost-and-routing-guide-fm4</guid>
      <description>&lt;p&gt;&lt;em&gt;I am the founder of PromptUnit. This post first appeared on the &lt;a href="https://www.promptunit.ai/blog/claude-haiku-vs-sonnet-routing-guide" rel="noopener noreferrer"&gt;PromptUnit blog&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Claude Haiku 5.5 costs $0.10 per million input tokens and $0.50 per million output tokens, and Claude Sonnet 5.5 costs $2 and $10. That makes Haiku 5.5 twenty times cheaper per token, a much wider gap than the 3x between Haiku 4.5 and Sonnet 4.6. Haiku is the right choice for short, well-defined tasks such as classification, extraction, summaries and simple chat; Sonnet earns its price on hard reasoning, complex code and long agent loops. The way to know which side each step of your app falls on is to test it on your own requests.&lt;/p&gt;

&lt;p&gt;Prices below come from &lt;a href="https://platform.claude.com/docs/en/about-claude/pricing" rel="noopener noreferrer"&gt;Anthropic's pricing page&lt;/a&gt; and were checked on November 9, 2026. &lt;a href="https://www.promptunit.ai/ai-api-pricing" rel="noopener noreferrer"&gt;Our AI API price pages&lt;/a&gt; are read from it every day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current Claude prices
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input (per 1M tokens)&lt;/th&gt;
&lt;th&gt;Output (per 1M tokens)&lt;/th&gt;
&lt;th&gt;Cached input&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 5.5 (prompts up to 100K tokens)&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;td&gt;$0.01&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 5.5 (prompts over 100K tokens)&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 5.5&lt;/td&gt;
&lt;td&gt;$4.00&lt;/td&gt;
&lt;td&gt;$20.00&lt;/td&gt;
&lt;td&gt;$0.20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 4.6&lt;/td&gt;
&lt;td&gt;$3.00&lt;/td&gt;
&lt;td&gt;$15.00&lt;/td&gt;
&lt;td&gt;$0.30&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two things the table does not show:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Haiku 5.5 counts more tokens for the same text.&lt;/strong&gt; It uses the tokenizer Anthropic introduced with Claude Opus 4.7, which counts the same text as about 30% more tokens than older models such as Haiku 4.5 and Sonnet 4.6. Sonnet 5.5 and Opus 5.5 use the same tokenizer as Haiku 5.5, so the 20x gap between them holds as written.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The long-prompt price.&lt;/strong&gt; Above 100,000 input tokens, Haiku 5.5 costs five times more per token. It is still far cheaper than Sonnet 5.5, but a long-document workload should be priced at the higher rate.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What changes in the API when you move to Haiku 5.5
&lt;/h2&gt;

&lt;p&gt;Haiku 5.5 is not a drop-in replacement for Haiku 4.5. Anthropic's &lt;a href="https://platform.claude.com/docs/en/models/haiku-5-5/migration-guide" rel="noopener noreferrer"&gt;Haiku 5.5 migration guide&lt;/a&gt; lists the differences that break existing code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;temperature&lt;/code&gt;, &lt;code&gt;top_p&lt;/code&gt; and &lt;code&gt;top_k&lt;/code&gt; return an error. Remove them from requests you send to Haiku 5.5.&lt;/li&gt;
&lt;li&gt;It thinks by default. Thinking text comes first, and thinking tokens count toward &lt;code&gt;max_tokens&lt;/code&gt; and are billed as output. For short tasks, turn thinking off, or the answer can be cut off and the cost per call goes up.&lt;/li&gt;
&lt;li&gt;A conversation that ends with an assistant turn (prefill) returns an error.&lt;/li&gt;
&lt;li&gt;A stop sequence made only of whitespace returns an error.&lt;/li&gt;
&lt;li&gt;Its safety classifiers can decline a request. Your code should handle a refusal and, where it matters, send the request to another model.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this is hard, but each one fails at runtime, so test the switch on real traffic before you rely on it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which tasks go where
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Usually fine on Haiku 5.5:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Classification and labeling: support ticket category, sentiment, intent.&lt;/li&gt;
&lt;li&gt;Extraction into fixed fields: names, dates, amounts, product attributes.&lt;/li&gt;
&lt;li&gt;Summaries of a single document or a short thread.&lt;/li&gt;
&lt;li&gt;Short generation with a clear format: notification copy, product descriptions, email drafts.&lt;/li&gt;
&lt;li&gt;Simple question answering over text you put in the prompt.&lt;/li&gt;
&lt;li&gt;Reformatting: JSON reshaping, normalizing fields, converting between formats.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Usually worth Sonnet 5.5:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multi-step reasoning and planning, where one early mistake carries through the answer.&lt;/li&gt;
&lt;li&gt;Complex code changes, debugging and code review on non-trivial diffs.&lt;/li&gt;
&lt;li&gt;Long agent loops that call tools and must keep track of state.&lt;/li&gt;
&lt;li&gt;Steps that judge, verify or approve other output. A weaker judge gives confident wrong verdicts, and nobody sees it until bad output ships.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are starting points, not rules. Two steps that look alike on paper can behave very differently on your prompts. In one app the PromptUnit team runs itself (checks up to October 12, 2026, small samples, judged by Claude Sonnet 5, the model the app asked for, so not independent), Claude Haiku 4.5 served the app's web-research step for five days with no errors and answers that passed the automatic format checks, yet it was judged worse than Sonnet 5 in 2 of 3 checks. Claude Haiku 5.5 was judged as good in only 4 of 8 checks on the same step. A research step looks like a summary, but it is not one.&lt;/p&gt;

&lt;h2&gt;
  
  
  A worked example
&lt;/h2&gt;

&lt;p&gt;Take 1 million requests a month at 800 input and 400 output tokens each, with 65% of them simple enough for Haiku 5.5 (classification, extraction, summaries, support replies) and 35% kept on Sonnet 5.5 (code and reasoning).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Everything on Sonnet 5.5:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input: 800M tokens x $2 = $1,600&lt;/li&gt;
&lt;li&gt;Output: 400M tokens x $10 = $4,000&lt;/li&gt;
&lt;li&gt;Total: &lt;strong&gt;$5,600 a month&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Split between Haiku 5.5 and Sonnet 5.5:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Haiku 5.5 (650,000 requests): 520M input x $0.10 = $52, plus 260M output x $0.50 = $130, so $182&lt;/li&gt;
&lt;li&gt;Sonnet 5.5 (350,000 requests): 280M input x $2 = $560, plus 140M output x $10 = $1,400, so $1,960&lt;/li&gt;
&lt;li&gt;Total: &lt;strong&gt;$2,142 a month, about 62% less&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Sonnet share is almost all of what is left. If tests show that a step you kept on Sonnet does just as well on Haiku, that step's share of the Sonnet cost drops by 95%.&lt;/p&gt;

&lt;p&gt;If you are coming from Haiku 4.5, the same 650,000 simple requests cost $1,820 on Haiku 4.5 (520M input x $1 plus 260M output x $5). On Haiku 5.5, after adding about 30% more tokens for its tokenizer (676M input and 338M output), they cost roughly $237, about an eighth.&lt;/p&gt;

&lt;h2&gt;
  
  
  How PromptUnit handles Haiku and Sonnet
&lt;/h2&gt;

&lt;p&gt;PromptUnit checks each request your app sends. When a cheaper model is just as good for that request, it uses it; otherwise the request goes to the model you asked for. Setup is one change: you paste your personal PromptUnit address where your app's Anthropic address (base URL) is set. Your own Anthropic key stays in your app.&lt;/p&gt;

&lt;p&gt;With the optional side-by-side checks turned on (off by default, paid on your own provider keys within a daily budget you set), cheaper models answer a sample of your real requests after your app already has its answer, and the model you asked for judges whether each cheaper answer is as good. A step of your app moves to a cheaper model on its own only after at least 20 judged checks with 9 in 10 as good and at least 10% lower cost, and it moves back if fewer than 7 in 10 stay as good. That is how the research step above stayed on Sonnet. The dashboard shows every request: the model asked for, the model that answered, what it cost and what it saved.&lt;/p&gt;

&lt;h2&gt;
  
  
  See also
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;LLM Routing: How It Works&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/anthropic-claude-api-pricing-guide-2026" rel="noopener noreferrer"&gt;Claude API Pricing Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/hidden-cost-of-defaulting-to-gpt4" rel="noopener noreferrer"&gt;The Hidden Cost of Defaulting to Your Flagship Model&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/claude-aws-bedrock-vs-anthropic-api-cost" rel="noopener noreferrer"&gt;Claude on AWS Bedrock vs the Anthropic API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://www.promptunit.ai/start" rel="noopener noreferrer"&gt;Start free&lt;/a&gt;: free until PromptUnit has saved you money.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How much cheaper is Claude Haiku 5.5 than Claude Sonnet 5.5?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Twenty times cheaper per token. Haiku 5.5 costs $0.10 per million input tokens and $0.50 per million output tokens for prompts up to 100,000 tokens, and Sonnet 5.5 costs $2 and $10. Both use the same tokenizer, so the same request is billed on the same number of tokens. Prices checked November 9, 2026.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I swap Claude Haiku 4.5 for Haiku 5.5 without changing my code?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Often not. Anthropic's migration guide says Haiku 5.5 rejects temperature, top_p and top_k, rejects a conversation that ends with an assistant turn (prefill), and thinks by default, with thinking tokens counted toward max_tokens. Remove those parameters, turn thinking off for simple tasks, and test before switching.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Claude Haiku 5.5 really cheaper than Haiku 4.5 if it counts more tokens?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes, by a wide margin. Haiku 5.5 counts the same text as about 30% more tokens than Haiku 4.5, but costs a tenth as much per token, so a request ends up at roughly an eighth of the Haiku 4.5 cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which tasks should stay on Claude Sonnet?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hard multi-step reasoning, complex code changes, long agent loops that call tools, and steps that judge or approve other output. A cheaper model that gets those wrong costs more in retries and bad output than it saves in tokens.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>claudehaiku</category>
    </item>
    <item>
      <title>Claude Mythos: What It Costs Now, and Why the Launch Price Didn't Stick</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Tue, 24 Nov 2026 14:00:37 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/claude-mythos-what-it-costs-now-and-why-the-launch-price-didnt-stick-25e</link>
      <guid>https://dev.to/scorpion4ik26lang/claude-mythos-what-it-costs-now-and-why-the-launch-price-didnt-stick-25e</guid>
      <description>&lt;p&gt;&lt;em&gt;I am the founder of PromptUnit. This post first appeared on the &lt;a href="https://www.promptunit.ai/blog/claude-mythos-glasswing-frontier-pricing" rel="noopener noreferrer"&gt;PromptUnit blog&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;On April 7, 2026, Anthropic announced Claude Mythos Preview and Project Glasswing. The model launched as a closed research-preview tier accessible only to about 50 launch partners including AWS, Apple, Broadcom, Cisco, CrowdStrike, Google, JPMorganChase, Linux Foundation, Microsoft, NVIDIA, and Palo Alto Networks, priced at $25 per million input tokens and $125 per million output tokens. Anthropic committed $100M in usage credits to seed the program.&lt;/p&gt;

&lt;p&gt;That launch price didn't hold. The current Claude Mythos 5.1 tier prices at $10 per million input tokens and $50 per million output tokens, the same rate as Claude Fable 5.1. That's still a premium tier, but a much smaller one than the original preview pricing suggested was coming.&lt;/p&gt;

&lt;p&gt;For context, Claude Opus 5.5 sits at $4/$20, and Claude Opus 5 and Opus 4.8 sit at $5/$25. Mythos at $10/$50 is roughly 2x Opus 5.5's rate, not the 5x premium the original preview pricing implied. OpenAI's o3-pro sits at $20/$80, meaning Mythos at its current price is actually cheaper than o3-pro on both input and output, a reversal from the launch positioning.&lt;/p&gt;

&lt;p&gt;If you are an engineering team running a normal SaaS production stack, you will not be calling Mythos this quarter. Your cost-routing decisions will not change because of this release. But the announcement says something specific about where frontier-model pricing is heading, and it does change two things you should plan for.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the gating actually signals
&lt;/h2&gt;

&lt;p&gt;Anthropic's framing of Project Glasswing is cybersecurity-focused: the model identified thousands of zero-days across major operating systems and browsers in pre-release testing. The capability story is real. The pricing and gating story is more interesting.&lt;/p&gt;

&lt;p&gt;Three things stand out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pricing tiers are bifurcating.&lt;/strong&gt; Through 2024 and most of 2025, frontier-model pricing followed a relatively smooth curve: every six months a new top model launched at roughly the price of the previous top model, and the previous tier dropped 30-50%. Opus 4.5's 67% price drop fit that pattern. Mythos launching at $25/$125 broke it, even though the price has since settled much lower at $10/$50. Anthropic signaled, at least at launch, that the most capable models might live in a separate pricing tier accessible only via partnership, though the subsequent price drop suggests that tier is converging back toward the public API rather than staying permanently separate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The frontier is being underwritten by partners, not customers.&lt;/strong&gt; $100M in usage credits across ~50 organizations works out to roughly $2M per org. That is closer to a strategic partnership budget than a typical enterprise API spend. The model is not paying for itself per token; it is paying for itself by anchoring a security ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The dialect matters.&lt;/strong&gt; Mythos is available through Claude API, Amazon Bedrock, Google Cloud Vertex AI, and Microsoft Foundry, but only to participating partners. That means the OpenAI-format proxy layer most production stacks rely on will not see Mythos as a routing target for the foreseeable future. If your routing logic assumes "any Anthropic model can be a target," that assumption now needs an asterisk.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this changes for normal teams
&lt;/h2&gt;

&lt;p&gt;Two practical things.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Opus 4.6 is going to stay at $5/$25 for longer than you might expect.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Historically, when a new frontier model launches, the previous frontier drops 30-50%. Opus 4.5 took that drop in November 2025, from $15/$75 down to $5/$25, and Opus 4.6 launched at the same price in February 2026. With Mythos taking the new "frontier" position behind a partnership wall, Anthropic has no public-API competitor pulling Opus 4.6 down further. The next price drop on Opus 4.6 will likely come when GPT-6 or a publicly-released Anthropic model competes with it on the open API, not from Mythos.&lt;/p&gt;

&lt;p&gt;For routing decisions, this means the cost ceiling on Anthropic's public-API tier is stable for the next two-to-three quarters. You can plan budgets against $5/$25 without worrying that a sudden price drop will reshuffle your routing logic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The "best available model" routing pattern needs to be redefined.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A common production routing pattern is "send the hardest 5% of requests to whatever the best frontier model is right now." If that pattern's definition of "best" tracks benchmark leaderboards, it will start trying to route to Mythos and failing. The routing layer needs to treat "best available to me" as the routing target, not "best in existence."&lt;/p&gt;

&lt;p&gt;This is a small but real change. We laid out the broader version of this trap in &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;our complete LLM model routing guide&lt;/a&gt;: routing should be defined by what the customer can actually call, not by what exists. Mythos makes this distinction load-bearing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cost calculation if you could access Mythos
&lt;/h2&gt;

&lt;p&gt;Suppose for the sake of argument that you could call Mythos. Should you? Take a workload of 10M monthly tokens (5M input, 5M output) routed to a frontier model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On Opus 4.6: $25 input + $75 output = &lt;strong&gt;$100/month&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;On o3-pro: $100 input + $400 output = &lt;strong&gt;$500/month&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;On Mythos (current $10/$50 pricing): $50 input + $250 output = &lt;strong&gt;$300/month&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is 2x Opus 4.6 for capability gains that, outside of cybersecurity-specific tasks, are unverified. For non-security workloads, the per-token cost-quality ratio almost certainly favors Opus 4.6 or a cheaper reasoning model like o3-mini. We walked through the equivalent math on the reasoning side in &lt;a href="https://www.promptunit.ai/blog/openai-o3-mini-vs-o3-cost-routing-guide" rel="noopener noreferrer"&gt;our o3 vs o3-mini analysis&lt;/a&gt;: the cheaper reasoning model is sometimes also the better one for the specific task.&lt;/p&gt;

&lt;p&gt;The honest read on Mythos for general engineering teams: even if access opened up tomorrow, most production routing logic should keep the model out of the hot path. The ROI math favors mid-tier models for almost everything except security-vulnerability hunting.&lt;/p&gt;

&lt;h2&gt;
  
  
  What partners are getting
&lt;/h2&gt;

&lt;p&gt;For the ~50 organizations in Project Glasswing, the math is different. The deal is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access to a model meaningfully ahead of public frontier on at least one capability axis (security)&lt;/li&gt;
&lt;li&gt;Pricing that, while expensive per-token, comes with $2M-ish in credits that effectively make the first quarter free&lt;/li&gt;
&lt;li&gt;Bedrock, Vertex AI, and Microsoft Foundry availability, so the integration cost is bounded&lt;/li&gt;
&lt;li&gt;A coordinated industry response to the security-AI race that reduces the chance of the model being misused by competitors&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The non-partners also get something, indirectly: the security industry overall benefits from coordinated zero-day discovery and patching. That is the public-good framing.&lt;/p&gt;

&lt;p&gt;What partners do not get: the right to redistribute Mythos access via their own products. If you are an AWS customer, you cannot call Mythos through Bedrock unless you are also a Glasswing partner. The partnership is upstream of your API key.&lt;/p&gt;

&lt;h2&gt;
  
  
  The two routing implications worth tracking
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;One: watch for tier consolidation.&lt;/strong&gt; Mythos launched at $25/$125, among the highest-priced widely-discussed models at the time, though it has since repriced to $10/$50. If OpenAI responds with a similarly-gated tier ("GPT-6 Foundation," available only to enterprise partners at premium pricing), the public-API price ceiling could solidify around $5-$10 input. That is good news for cost-optimizing teams: it caps the worst-case routing target, and makes mid-tier models genuinely competitive on a wider range of tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two: watch for capability bifurcation.&lt;/strong&gt; If the gated tier consistently leads on specialized capabilities (security, biology, physics simulation), the routing decision for those specialized workloads becomes "build it ourselves with mid-tier models" or "partner up." For most B2B SaaS teams, the answer will be the former. The mid-tier models are good enough for 95% of workloads, and the operational cost of partnering for 5% rarely pencils out.&lt;/p&gt;

&lt;p&gt;We covered the broader pattern of "the cheapest routing target that meets the quality bar wins" in &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;our cross-provider LLM routing post&lt;/a&gt;. Mythos is the high end of that pattern: a tier that is technically a routing target for ~50 organizations, and a non-target for everyone else.&lt;/p&gt;

&lt;h2&gt;
  
  
  How PromptUnit handles this
&lt;/h2&gt;

&lt;p&gt;PromptUnit only routes to models the customer can actually call, and Mythos is not one of them until customer access exists.&lt;/p&gt;

&lt;p&gt;If you are planning your 2026 LLM budget against the published price tiers, the practical advice is to anchor against Opus 4.6 and GPT-5.4 as the realistic ceiling, not Mythos. The math at $5/$25 still has plenty of room for routing optimization. &lt;a href="https://www.promptunit.ai" rel="noopener noreferrer"&gt;Start free at promptunit.ai&lt;/a&gt; and see how much of your current frontier-tier spend belongs on a cheaper route.&lt;/p&gt;

&lt;p&gt;For the Claude Haiku vs Sonnet routing guide, see &lt;a href="https://www.promptunit.ai/blog/claude-haiku-vs-sonnet-routing-guide" rel="noopener noreferrer"&gt;Claude Haiku vs Sonnet: Routing Guide&lt;/a&gt;. For the cross-provider routing guide, see &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;Cross-Provider LLM Routing&lt;/a&gt;. For the full routing strategy framework, see &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;LLM Model Routing: The Complete Guide&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  See Also
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/claude-haiku-vs-sonnet-routing-guide" rel="noopener noreferrer"&gt;Claude Haiku vs Sonnet Routing Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/gpt-5-5-doubled-price-claude-opus-4-7-routing" rel="noopener noreferrer"&gt;GPT-5.5 Doubled Price&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;LLM Model Routing Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;Cross-Provider LLM Routing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/openai-api-too-expensive-what-to-do" rel="noopener noreferrer"&gt;Reduce OpenAI API Costs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Try It Free
&lt;/h2&gt;

&lt;p&gt;See exactly where your AI budget is going. PromptUnit shows every request with the model that answered, what it cost and what it saved, starting with your first one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.promptunit.ai/sign-up" rel="noopener noreferrer"&gt;Start free&lt;/a&gt;, no credit card needed. Or &lt;a href="https://www.promptunit.ai/talk" rel="noopener noreferrer"&gt;talk to us&lt;/a&gt; if you want a walkthrough.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>claudemythos</category>
    </item>
    <item>
      <title>n8n OpenAI Costs Too High? 5 Fixes That Work</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Fri, 20 Nov 2026 14:00:37 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/n8n-openai-costs-too-high-5-fixes-that-work-ll5</link>
      <guid>https://dev.to/scorpion4ik26lang/n8n-openai-costs-too-high-5-fixes-that-work-ll5</guid>
      <description>&lt;p&gt;&lt;em&gt;I am the founder of PromptUnit. This post first appeared on the &lt;a href="https://www.promptunit.ai/blog/n8n-openai-cost-reduction-guide" rel="noopener noreferrer"&gt;PromptUnit blog&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The fastest way to cut your n8n OpenAI bill is to stop sending every step to your most expensive model. Most n8n workflows mix task types, and classification, extraction, and summarization steps can run on models costing 20 to 50 times less than a flagship without any noticeable quality drop. Beyond model choice, three more levers matter: trimming the tokens you send, caching repetitive calls, and using n8n's batch-ready structure to defer non-urgent work. This article walks through each one with actual November 2026 prices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why n8n Workflows Overspend on OpenAI
&lt;/h2&gt;

&lt;p&gt;n8n does not bundle LLM costs. Every token your workflow sends to OpenAI is billed directly to your API key at whatever model rate you configured. That means a misconfigured model choice compounds with every execution.&lt;/p&gt;

&lt;p&gt;The most common pattern is a workflow that was prototyped with GPT-4o or a newer flagship because "it worked reliably," then went to production without anyone revisiting the model. At 200,000 monthly executions with 20,000 input tokens per call, GPT-4o at $2.50 per million input tokens adds up to $10,000 in input tokens alone. That figure is very sensitive to model choice: moving to GPT-6 Luna at $0.10 per million input tokens would cost $400 for the same volume.&lt;/p&gt;

&lt;p&gt;A second common issue is context growth. n8n's memory nodes add past messages to every request, so with a large window a workflow that starts at 1,000 input tokens per turn can reach 20,000 tokens after 20 turns, multiplying your bill by 20x on a long-running agent.&lt;/p&gt;

&lt;p&gt;A third is model deprecation risk. If your workflow still names &lt;code&gt;gpt-4o-2024-08-06&lt;/code&gt; or &lt;code&gt;gpt-4.1-2025-04-14&lt;/code&gt;, both have been deprecated as of October 14, 2026 and will stop working on January 14, 2027. The recommended replacement is &lt;code&gt;gpt-6-luna&lt;/code&gt; for most of those workloads.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 1: Audit What Each Step Actually Needs
&lt;/h2&gt;

&lt;p&gt;Before changing any configuration, map what each AI node in your workflow is doing. n8n workflows typically mix at least three task types with very different model requirements:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task type&lt;/th&gt;
&lt;th&gt;Typical tokens/call&lt;/th&gt;
&lt;th&gt;Minimum capable model&lt;/th&gt;
&lt;th&gt;Cost per million input tokens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Classification / routing&lt;/td&gt;
&lt;td&gt;200-600&lt;/td&gt;
&lt;td&gt;GPT-6 Luna&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Extraction / structured JSON&lt;/td&gt;
&lt;td&gt;500-2,000&lt;/td&gt;
&lt;td&gt;GPT-6 Luna or GPT-5.4 mini&lt;/td&gt;
&lt;td&gt;$0.10-$0.75&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Summarization&lt;/td&gt;
&lt;td&gt;2,000-8,000&lt;/td&gt;
&lt;td&gt;GPT-5.4 mini or GPT-5.6 Terra&lt;/td&gt;
&lt;td&gt;$0.75-$2.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Long-form generation / reasoning&lt;/td&gt;
&lt;td&gt;2,000-10,000+&lt;/td&gt;
&lt;td&gt;GPT-5.6 Sol or GPT-6.1 Sol&lt;/td&gt;
&lt;td&gt;$2.00-$4.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;(All prices from OpenAI's pricing page, November 2026. GPT-4o and GPT-4o mini are deprecated with a January 14, 2027 shutdown date and should not be used in new configurations.)&lt;/p&gt;

&lt;p&gt;A classification step that labels incoming emails as "billing," "support," or "sales" does not need GPT-5.5 at $5.00 per million input tokens. GPT-6 Luna at $0.10 handles it. At 600 input tokens a call, 50,000 classifications a month cost $150 in input on GPT-5.5 and $3 on GPT-6 Luna, a 50x difference for the same label.&lt;/p&gt;

&lt;p&gt;For steps that need more reasoning, GPT-5.4 mini at $0.75 input / $4.50 output is a good middle tier. It costs 85% less than GPT-5.5 and handles extraction and moderate summarization well for most production workloads. See &lt;a href="https://www.promptunit.ai/blog/gpt-5-4-mini-vs-flagship-routing" rel="noopener noreferrer"&gt;the routing math behind similar trade-offs&lt;/a&gt; if you want worked token examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 2: Change the Model in the n8n Credential
&lt;/h2&gt;

&lt;p&gt;In n8n, the OpenAI credential has a &lt;strong&gt;Base URL&lt;/strong&gt; field alongside the API key. By default it points to &lt;code&gt;https://api.openai.com/v1&lt;/code&gt;, but you can point it at any OpenAI-compatible endpoint and control which model the node calls by changing the model ID in the node's settings.&lt;/p&gt;

&lt;p&gt;To change the model for a specific step without touching other nodes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the OpenAI Chat Model sub-node connected to your AI Agent or Basic LLM Chain.&lt;/li&gt;
&lt;li&gt;Change the Model field to the new model ID (for example, from &lt;code&gt;gpt-5.5&lt;/code&gt; to &lt;code&gt;gpt-5.4-mini&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;If you want a node-level Base URL override instead of a credential-level one, go to Options in the OpenAI Chat Model sub-node. The node-level setting takes priority over the credential.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If your workflow uses multiple AI steps with different quality requirements, you can connect separate OpenAI Chat Model sub-nodes to each AI node, each with a different model ID. n8n's Switch node can then route items to the appropriate agent based on a complexity score or task type you compute earlier in the workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 3: Trim the Tokens You Send
&lt;/h2&gt;

&lt;p&gt;Shorter prompts cost less. Three places where n8n workflows waste tokens:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;System prompts.&lt;/strong&gt; It is common to include multi-paragraph system prompts on every call. At 800 input tokens in the system prompt across 100,000 calls per month, you're spending 80 million tokens just on the prompt. At GPT-5.5 prices ($5.00 per million), that's $400 per month in system-prompt-only spend. Cutting the system prompt to 200 tokens saves $300 per month on that model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unfiltered data passthrough.&lt;/strong&gt; When a workflow pulls JSON from an API and passes the whole object to an LLM, it often includes dozens of fields the LLM ignores. A Set or Code node upstream can strip the payload to only the fields the LLM needs. This is free to compute in n8n and can cut input tokens by 50 to 80 percent on data-heavy workflows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A memory window larger than needed.&lt;/strong&gt; The Window Memory node sends a set number of past messages with every call. For a workflow invoked dozens of times in a session, that adds up quickly. Set the window to the minimum number of turns that keeps the agent coherent for your specific task. Detailed techniques for prompt compression are in &lt;a href="https://www.promptunit.ai/blog/llm-token-reduction-techniques" rel="noopener noreferrer"&gt;this guide to reducing token count without losing quality&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 4: Cache Repetitive Calls
&lt;/h2&gt;

&lt;p&gt;n8n has no built-in LLM response cache, but you can add a Redis or database lookup node before any LLM node. The pattern is straightforward: hash the input (the Code node can do this), query Redis, return the cached response if it exists, and only continue to the LLM if it doesn't. For workflows where many executions share similar inputs, like translating a fixed set of product descriptions or classifying from a small label set, this can eliminate a large share of LLM calls entirely.&lt;/p&gt;

&lt;p&gt;If you are routing through an OpenAI-compatible proxy, some of them include exact-match caching for free. An exact repeat of the same request (same model, messages, and settings) can be served from cache without touching OpenAI's API at all.&lt;/p&gt;

&lt;p&gt;For input that isn't identical but shares long repeated sections, like a system prompt or document that appears in every call, OpenAI's prompt caching (available on GPT-5.x and GPT-6.x models) automatically discounts tokens that reappear in context. Cached input tokens on GPT-5.4 cost $0.25 per million versus $2.50 uncached, a 90% reduction on the repeated portion. The &lt;a href="https://www.promptunit.ai/blog/prompt-caching-cost-savings-openai-anthropic" rel="noopener noreferrer"&gt;prompt caching breakdown&lt;/a&gt; covers which conditions trigger a cache hit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 5: Defer Non-Urgent Calls to Batch Processing
&lt;/h2&gt;

&lt;p&gt;If some steps in your workflow don't need a synchronous result, OpenAI's Batch API cuts costs by 50 percent across all supported models. At GPT-5.4, batch pricing is $1.25 input / $7.50 output per million tokens versus $2.50 / $15 at standard. At GPT-5.6 Sol, it's $2 / $10 versus $4 / $20.&lt;/p&gt;

&lt;p&gt;In n8n, this means collecting inputs over a time window, sending them as a batch job via an HTTP Request node to &lt;code&gt;/v1/batches&lt;/code&gt;, then polling for results when the job completes. The workflow is slightly more complex to build but the approach works well for nightly summarization, weekly report generation, or any pipeline where a few hours of latency is acceptable. The &lt;a href="https://www.promptunit.ai/blog/batch-api-50-percent-routing-decision" rel="noopener noreferrer"&gt;batch API decision guide&lt;/a&gt; has more detail on what to move and what to keep synchronous.&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting It Together: Per-Step Model Assignment
&lt;/h2&gt;

&lt;p&gt;The most reliable way to control n8n AI costs at scale is to treat your workflow as a pipeline with explicit model assignments per step, not a single model setting applied everywhere. A workflow with five AI steps might assign them like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input classifier&lt;/strong&gt; (labels ticket type): GPT-6 Luna at $0.10 input&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Field extractor&lt;/strong&gt; (pulls structured data from free text): GPT-6 Luna or GPT-5.4 mini at $0.10-$0.75 input&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context summarizer&lt;/strong&gt; (condenses prior conversation): GPT-5.4 mini at $0.75 input&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Response drafter&lt;/strong&gt; (writes a customer-facing reply): GPT-5.6 Terra at $2.00 input&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quality checker&lt;/strong&gt; (flags off-topic or policy violations): GPT-6 Luna at $0.10 input&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That structure can be 5 to 20 times cheaper than using a single mid-to-high tier model across all five steps, with no change to the steps that actually need quality.&lt;/p&gt;

&lt;p&gt;If manually auditing and assigning models per step feels like ongoing maintenance, a per-request cost router like &lt;a href="https://www.promptunit.ai" rel="noopener noreferrer"&gt;PromptUnit&lt;/a&gt; can sit between n8n and OpenAI: in the OpenAI credential, you paste your personal PromptUnit address into the Base URL field, and the API Key field keeps your own OpenAI key. Each request is then checked: when a cheaper model is just as good for it, PromptUnit uses it; otherwise the request goes to the model you asked for. The dashboard shows what each step costs and saves, which makes the audit described above much faster. The setup for n8n specifically is documented at &lt;a href="https://www.promptunit.ai/docs/connect/n8n" rel="noopener noreferrer"&gt;promptunit.ai/docs/connect/n8n&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The common thread across all five fixes is the same: the cost problem in most n8n workflows isn't that AI is inherently expensive, it's that a model chosen for prototyping was never re-examined once it went to production. The &lt;a href="https://www.promptunit.ai/blog/ai-cost-optimization-checklist-2026" rel="noopener noreferrer"&gt;AI cost optimization checklist&lt;/a&gt; has a full 15-step process if you want a structured way to work through the rest of your stack.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why is my n8n OpenAI bill so high even for simple workflows?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;n8n bills LLM tokens directly through your OpenAI API key, so the cost depends entirely on which model you picked and how many tokens each call sends. The most common cause is using a flagship model like GPT-5.5 or GPT-5.6 Sol for tasks like classification or extraction that a much cheaper model (GPT-6 Luna at $0.10 per million input tokens) can handle equally well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I change the AI model in an n8n workflow?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open the OpenAI Chat Model sub-node connected to your AI Agent or LLM Chain and change the Model field to the new model ID. You can also set a different Base URL in the OpenAI credential to route calls to a different endpoint, or override it per node under Options in the OpenAI Chat Model sub-node.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I use different models for different steps in the same n8n workflow?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes. Connect a separate OpenAI Chat Model sub-node to each AI Agent or LLM Chain node and set a different model ID on each one. A Switch node earlier in the workflow can also route items dynamically based on task type or complexity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are GPT-4o and GPT-4o mini still safe to use in n8n in late 2026?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. Both GPT-4o and GPT-4o mini were deprecated by OpenAI on October 14, 2026 and will stop working on January 14, 2027. OpenAI recommends migrating to GPT-6 Luna as the replacement. Update your n8n nodes before that date to avoid workflow failures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does n8n have built-in LLM cost tracking or caching?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;n8n does not have built-in LLM cost tracking or response caching. For caching, you can add a Redis lookup node before any LLM node to skip the API call when the same input repeats. For cost tracking, you need to log token usage from API responses to an external store, or use a proxy that records per-request spend.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>n8n</category>
    </item>
    <item>
      <title>Function Calling: Why Agent Loops Bill 5x Your Estimate</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Tue, 17 Nov 2026 14:00:37 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/function-calling-why-agent-loops-bill-5x-your-estimate-8e1</link>
      <guid>https://dev.to/scorpion4ik26lang/function-calling-why-agent-loops-bill-5x-your-estimate-8e1</guid>
      <description>&lt;p&gt;&lt;em&gt;I am the founder of PromptUnit. This post first appeared on the &lt;a href="https://www.promptunit.ai/blog/tool-use-function-calling-hidden-cost" rel="noopener noreferrer"&gt;PromptUnit blog&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Consider a team building a customer-support agent in production. The estimate from the planning doc is $4,000/month at 50K resolved tickets, with an average of 3 LLM calls per resolution. Three months in, the actual bill is $19,000.&lt;/p&gt;

&lt;p&gt;The calls-per-ticket assumption was right. The token count per call was wrong. By a lot.&lt;/p&gt;

&lt;p&gt;Function calling and tool use have a cost shape that is not obvious from reading the API docs. The published price is per input and output token; the docs do not explain how aggressively a typical agent loop accumulates context, re-sends tool definitions, and re-includes tool results on every turn. The result, for almost every team building agents in 2026, is a bill 3-5x what their back-of-envelope math predicted.&lt;/p&gt;

&lt;p&gt;This post is about where the multiplier comes from, the four most common architectural mistakes, and the routing pattern that bounds the cost without breaking the agent.&lt;/p&gt;

&lt;h2&gt;
  
  
  The multiplier comes from three places
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Tool definitions are sticky.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you register tools with OpenAI, Anthropic, or any other provider, the tool definitions count as input tokens on every call. A typical production agent has 8-15 tools. Each tool definition includes a name, description, parameter schema, and often per-parameter descriptions. A well-specified tool runs 200-400 tokens. Eight tools at 300 tokens each is 2,400 tokens of tool definitions in every prompt, before the conversation has even started.&lt;/p&gt;

&lt;p&gt;If your agent has 5 turns in a conversation, you pay for those 2,400 tokens five times. That is 12,000 input tokens of tool definitions per conversation, none of which the user typed and none of which the model is "thinking about" in any productive way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Tool results get accumulated.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In an agent loop, when the model calls a tool, the result gets appended to the conversation history. Subsequent turns include the full conversation, including every prior tool call's input arguments and its output. A tool that returns a 500-line JSON document means every subsequent turn is 500 lines longer.&lt;/p&gt;

&lt;p&gt;For agents that fetch data (search results, database queries, API responses), the conversation context can grow by tens of thousands of tokens across a 5-turn loop. By turn 5, the prompt being sent to the model might be 30K tokens, of which 28K is tool-result history.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Reasoning models bill the chain-of-thought tokens.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you are using o3 or &lt;a href="https://www.promptunit.ai/blog/deepseek-v4-pro-open-weight-routing" rel="noopener noreferrer"&gt;DeepSeek V4 Pro&lt;/a&gt; (thinking mode is on by default) for the agent's reasoning step, the model's internal chain-of-thought tokens count as output. A "simple" agent decision that resolves to "call tool X with these arguments" might involve 2,000-4,000 tokens of internal reasoning the user never sees but pays for in full.&lt;/p&gt;

&lt;p&gt;These three multipliers stack. A 5-turn agent loop with 8 tools, two tool calls per turn, and a reasoning model can bill 10x the input tokens and 5x the output tokens of the user's actual conversation length.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the bill actually lands
&lt;/h2&gt;

&lt;p&gt;Take that customer-support agent. Plan-doc math (see the &lt;a href="https://www.promptunit.ai/blog/openai-api-too-expensive-what-to-do" rel="noopener noreferrer"&gt;OpenAI API pricing guide&lt;/a&gt; for current model rates):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Average ticket: 3 LLM calls&lt;/li&gt;
&lt;li&gt;Average call: 1,500 input + 800 output&lt;/li&gt;
&lt;li&gt;50,000 tickets: 225M input + 120M output tokens&lt;/li&gt;
&lt;li&gt;On GPT-5.4 ($2.50 / $15.00 per million tokens): $562 + $1,800 = &lt;strong&gt;$2,362/month&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The estimate was $4K because the planning doc added a 70% buffer for variance. Reality:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;8 tools × 300 tokens = 2,400 tokens of tool definitions per call (always present)&lt;/li&gt;
&lt;li&gt;Tool results averaging 1,200 tokens each, 1.5 tool calls per turn = 1,800 tokens accumulating per turn&lt;/li&gt;
&lt;li&gt;By turn 3, prompt has accumulated 5,400 tokens of tool-result history&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Real average call: 5,400 input + 800 output&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;50,000 tickets × 3 calls × (5,400 + 800) tokens = ~930M tokens&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Split roughly 750M input + 180M output&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On GPT-5.4: $1,875 + $2,700 = &lt;strong&gt;$4,575/month&lt;/strong&gt; at the low end&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The actual bill, with longer-than-average tool results and some reasoning-model usage: &lt;strong&gt;$19K&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The plan-doc math underestimated by 4-5x because it counted the user-visible portion of the conversation and missed the structural overhead.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four mistakes that produce the multiplier
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Mistake one: not caching tool definitions.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tool definitions are perfect cache material. They are static, identical across calls, and consume 1,500-4,000 tokens per request. Anthropic's prompt caching at 90% off (or OpenAI's at up to 90% off) cuts the per-call tool-definition tax to a fraction of its previous size. Most teams know caching exists; most do not structure their tool definitions to maximize cache hits because the cache key depends on prompt prefix ordering. For tool-heavy workloads, getting that ordering right is the single highest-leverage change available before touching any routing logic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mistake two: passing full tool results into subsequent turns.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If a tool returns a 500-line JSON document, the agent rarely needs all 500 lines for the next turn's decision. Most teams pass the full result back because it is the easy default. The fix is a tool-result summarization step: after each tool call, run a small, cheap, fast model to extract the relevant fields and pass only those into subsequent turns. The summarization step costs a fraction of what long-tail context accumulation would. We covered the broader cost pattern in &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;our LLM model routing guide&lt;/a&gt;; agent loops are the most extreme version of why per-call routing matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mistake three: using one big model for all turns.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A typical agent loop has heterogeneous turns. Turn one might decide "this is a refund request, call the refund-policy lookup tool." That decision does not need GPT-5.4 or Claude Opus. Turn three might be "synthesize all the gathered context into a final response to the user." That does need a strong model.&lt;/p&gt;

&lt;p&gt;Routing every turn to the same model means paying frontier prices for the easy turns. The fix is per-turn routing: cheap, fast models on the routing and dispatch turns; stronger models on the synthesis turns. This is the same pattern as fan-out routing, which we walked through in &lt;a href="https://www.promptunit.ai/blog/groq-llama-routing-latency-tier" rel="noopener noreferrer"&gt;our Groq latency-tier analysis&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mistake four: accumulating reasoning traces in conversation history.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When using a reasoning model for an agent step, some teams include the model's chain-of-thought tokens in the conversation history that gets sent to subsequent turns. This is rarely intentional; it usually happens because the agent framework does not distinguish between visible-to-user output and internal reasoning, and just concatenates everything.&lt;/p&gt;

&lt;p&gt;The fix is to drop the reasoning trace from the conversation context after the tool call resolves. Keep the tool call itself and its result; drop the chain of thought. This often cuts input token count on subsequent turns by 30-60% with zero quality impact.&lt;/p&gt;

&lt;h2&gt;
  
  
  The routing pattern that works
&lt;/h2&gt;

&lt;p&gt;For an agent with 8 tools and 3-5 turn loops, the pattern that produces the lowest bill at production-grade quality:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Routing turn (decide which tool to call):&lt;/strong&gt; a small open model such as GPT OSS 20B on Groq, at $0.075 per million input tokens on &lt;a href="https://console.groq.com/docs/models" rel="noopener noreferrer"&gt;Groq's models page&lt;/a&gt; (November 8, 2026). Even without caching, the 2,400 tokens of tool definitions cost about $0.0002 per turn (2,400 × $0.075 / 1,000,000). Llama 3.1 8B, the usual choice here before, is now on Groq's Enterprise plan only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool-result summarization turn:&lt;/strong&gt; Same small model. Cheap, fast, and extracts only what subsequent turns need.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Synthesis turn (generate user-facing response):&lt;/strong&gt; GPT-4o-mini ($0.15/MTok) or GPT-5.4-mini ($0.75/MTok). The synthesis turn needs quality but not necessarily frontier capability. For routing across Anthropic and Google providers as synthesis alternatives, &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;cross-provider LLM routing&lt;/a&gt; covers the setup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reasoning escalation (only when synthesis fails or the task is complex):&lt;/strong&gt; o3 or DeepSeek V4 Pro in thinking mode, called less than 5% of turns.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the customer-support agent above, this pattern collapses the bill from $19K to roughly $2,500/month, with no measurable quality drop on resolution rate. The savings come from three places: cheap routing turns, summarized context, and avoiding reasoning models on turns that do not need them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The instrumentation that catches the multiplier early
&lt;/h2&gt;

&lt;p&gt;Most teams discover their agent-loop multiplier in the third month, when the bill arrives. The instrumentation that catches it in week one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Per-turn token count, not just per-call token count.&lt;/strong&gt; A 5-turn loop billed at 30K total tokens looks normal; a 5-turn loop billed at 30K, 32K, 35K, 38K, 40K (compounding accumulation) is a red flag.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool-definition share of total input.&lt;/strong&gt; If tool definitions account for more than 15% of total input tokens, caching is mis-configured.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool-result share of total input.&lt;/strong&gt; If tool results account for more than 30% of total input tokens by turn 3, summarization is missing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per-tool call cost.&lt;/strong&gt; Not all tools are equally expensive. A tool that returns 5,000-token JSON blobs on every call deserves a separate line item in your cost dashboard.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without these metrics, the agent-loop bill is a black box. Adding them takes a day. How much acting on them saves depends on the agent: in our early data from one agent pipeline, routing lowered the bill by about 11%, because most of its spend was long writing steps that stay on the stronger model. A pipeline with many simple calls can save more.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one architectural choice that bounds the worst case
&lt;/h2&gt;

&lt;p&gt;If you read nothing else from this post: separate the agent's "what should I do next" decision (the routing turn) from the agent's "do the actual work" decision (the synthesis turn), and route them to different models.&lt;/p&gt;

&lt;p&gt;The routing turn is small, frequent, and well-suited to a cheap fast model. The synthesis turn is rarer, longer, and earns a stronger model. Most agent frameworks default to "use one model for everything" because it is the simplest configuration. That default is also the one that produces the 5x multiplier on the bill.&lt;/p&gt;

&lt;p&gt;The four mistakes above are the tool-use-specific version of a broader pattern. For the general math on how token count compounds step by step in any multi-step agent loop, and the design patterns that bound it, see &lt;a href="https://www.promptunit.ai/blog/multi-agent-llm-cost-spiral" rel="noopener noreferrer"&gt;The Multi-Agent Cost Spiral: Why Agentic AI Systems Cost 10-100x More Than You Expect&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once you have two routing tiers wired up, the per-turn cost dynamics become visible and tunable. Every subsequent optimization (caching, summarization, reasoning-trace pruning) plugs into that same two-tier scaffolding without breaking the agent.&lt;/p&gt;

&lt;h2&gt;
  
  
  How PromptUnit handles this
&lt;/h2&gt;

&lt;p&gt;PromptUnit does not reroute agent turns that carry tools. A request with tool definitions or tool results goes to the model you asked for, unchanged, so the loop keeps working exactly as before. Where it helps is the plain text calls around the loop, such as summaries, classification and short answers: those can go to a cheaper model when that model is just as good. The dashboard shows every request with the model that answered, what it cost and what it saved, and groups requests into the steps of your agent, so you can see which steps drive the bill before you build the two-tier routing described above.&lt;/p&gt;

&lt;p&gt;If your agent-loop bill is the line item your CFO is asking about, the per-turn routing pattern is the cleanest single intervention available. &lt;a href="https://www.promptunit.ai" rel="noopener noreferrer"&gt;Start free at promptunit.ai&lt;/a&gt; and see what each step of your agent costs.&lt;/p&gt;

&lt;p&gt;For the full model routing strategy that powers this optimization, see &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;LLM Model Routing: The Complete Guide&lt;/a&gt;. For the hidden invoice costs that compound agent loop spend, see &lt;a href="https://www.promptunit.ai/blog/hidden-cost-of-defaulting-to-gpt4" rel="noopener noreferrer"&gt;The Hidden Cost of Defaulting to GPT-4o&lt;/a&gt;. For multi-provider routing that reduces per-turn costs further, see &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;Cross-Provider LLM Routing&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Try It Free
&lt;/h2&gt;

&lt;p&gt;See exactly where your AI budget is going. PromptUnit shows every request with the model that answered, what it cost and what it saved, starting with your first one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.promptunit.ai/sign-up" rel="noopener noreferrer"&gt;Start free&lt;/a&gt;, no credit card needed. Or &lt;a href="https://www.promptunit.ai/talk" rel="noopener noreferrer"&gt;talk to us&lt;/a&gt; if you want a walkthrough.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>functioncalling</category>
    </item>
    <item>
      <title>The Multi-Agent Cost Spiral: Why Agent Loops Cost So Much</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Fri, 13 Nov 2026 14:00:37 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/the-multi-agent-cost-spiral-why-agent-loops-cost-so-much-1dp0</link>
      <guid>https://dev.to/scorpion4ik26lang/the-multi-agent-cost-spiral-why-agent-loops-cost-so-much-1dp0</guid>
      <description>&lt;p&gt;&lt;em&gt;I am the founder of PromptUnit. This post first appeared on the &lt;a href="https://www.promptunit.ai/blog/multi-agent-llm-cost-spiral" rel="noopener noreferrer"&gt;PromptUnit blog&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most teams that build their first multi-agent AI system are shocked by the first billing cycle. A workload that costs $0.02 per run as a single-call prompt can easily reach $0.45 per run once it becomes a 20-step agent loop. That is a 22x cost increase for the same underlying task. The technical explanation is straightforward once you see it, but it is not obvious until you have built a few agents and watched the token counts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Token Count Compounds Across Agent Steps
&lt;/h2&gt;

&lt;p&gt;The core issue is that every step in an agent loop does not start from scratch. It starts with everything that came before it: the original task description, the outputs of every prior step, every tool call result, and every intermediate reasoning trace. The conversation history accumulates, and you send it in full with every new request.&lt;/p&gt;

&lt;p&gt;Walk through a simple five-step agent. The initial task is 1,000 tokens. Step 1 receives 1,000 tokens of input, generates 200 tokens of output, and calls a tool that returns 500 tokens of results. Step 2 now starts with 1,000 tokens of original context plus 200 tokens from step 1's output plus 500 tokens of tool results, totaling 1,700 tokens of input. Step 2 generates 300 tokens and calls a tool that returns 400 tokens. Step 3 starts with 2,400 tokens of input. By step 5, you are sending over 4,000 tokens of accumulated context just to handle the next incremental step in the task.&lt;/p&gt;

&lt;p&gt;Add up the total input tokens across all five steps: 1,000 plus 1,700 plus 2,400 plus 3,200 plus 4,000 equals 12,300 tokens. A single-call equivalent that sends the full task context and receives the final answer might use 1,500 tokens of input. The five-step agent used 8.2 times more input tokens to accomplish the same task.&lt;/p&gt;

&lt;p&gt;At 20 steps, the compounding is severe. If the average context grows by 600 tokens per step (a mix of model output and tool results), step 20 starts with 1,000 plus 19 times 600, which equals 12,400 tokens of input context. The cumulative input token count across all 20 steps, assuming linear growth, is approximately 20 times 6,700 (average context size across all steps), which equals 134,000 tokens. The single-call equivalent is still around 1,500. That is roughly 90 times more input tokens.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Dollar Impact at Production Scale
&lt;/h2&gt;

&lt;p&gt;Using Claude Sonnet 4.6 at $3.00 per million input tokens and $15.00 per million output tokens, here is what a realistic 20-step agent costs per run. Each step sends an average of 5,000 tokens of context and generates 500 tokens of output. Input cost: 20 steps times 5,000 tokens divided by 1,000,000 times $3.00 equals $0.30 per run. Output cost: 20 steps times 500 tokens divided by 1,000,000 times $15.00 equals $0.15 per run. Total: $0.45 per agent run.&lt;/p&gt;

&lt;p&gt;At 1,000 runs per day, that is $450 per day, or $13,500 per month. The comparable single-call task, generating 500 output tokens with 1,500 tokens of input, would cost about $0.015 per run, or $450 per month. The agent system costs 30 times more per month for the same task throughput.&lt;/p&gt;

&lt;p&gt;For teams running agents at scale, this is not a theoretical concern. It is why multi-agent architectures require fundamentally different cost discipline than single-call applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Patterns That Make It Worse
&lt;/h2&gt;

&lt;p&gt;Several common agent design patterns amplify the token multiplication problem beyond the baseline compounding effect.&lt;/p&gt;

&lt;p&gt;Re-reading the full task description at every step is one of the most wasteful patterns. If your agent's system prompt or task description is 2,000 tokens and it is re-injected at every step, you are paying for those 2,000 tokens 20 times. This is a direct candidate for prompt caching, which cuts the cost of those repeated tokens by 90% on Anthropic models. See the &lt;a href="https://www.promptunit.ai/blog/prompt-caching-cost-savings-openai-anthropic" rel="noopener noreferrer"&gt;prompt caching cost savings guide&lt;/a&gt; for implementation details.&lt;/p&gt;

&lt;p&gt;Keeping all tool outputs in context even after they are no longer needed is another common issue. If step 3 calls a database query and retrieves 1,000 tokens of results, and those results are only relevant for steps 3 and 4, there is no reason to carry them forward through steps 5 through 20. Most agents do this by default because it is the path of least resistance. Every unnecessary token in context from a prior tool call adds to every subsequent step's token count.&lt;/p&gt;

&lt;p&gt;Using frontier models for every step is perhaps the most avoidable cost amplifier. A 20-step agent typically has a mix of task types: some steps require genuine reasoning, while others are classification, routing, formatting, or simple extraction. Running all of them on Opus 4.8 or Claude Sonnet 4.6 when a Haiku 4.5 or GPT-4o-mini call would handle the simple steps adequately means paying premium rates for work that does not require it.&lt;/p&gt;

&lt;p&gt;Not having early-exit conditions is the fourth common pattern. Agents that run a fixed number of steps regardless of whether the task is complete burn tokens on unnecessary cycles. If the task is solved at step 7, steps 8 through 20 are waste. Building confidence thresholds or completion-check logic that terminates the agent loop early is a straightforward optimization that many teams skip in the interest of shipping faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design Patterns That Control Costs
&lt;/h2&gt;

&lt;p&gt;The most impactful change is mixing model tiers within a single agent pipeline. Map out every step in your agent and classify it: does this step require reasoning, synthesis, or judgment? Or is it routing, classification, formatting, or simple lookup? The latter category can run on Haiku 4.5 at $1.00/$5.00 per MTok instead of Sonnet 4.6 at $3.00/$15.00. On a 20-step agent where 12 steps are simple and 8 require reasoning, you can cut your model costs by 50 to 60% without changing the quality of the final output.&lt;/p&gt;

&lt;p&gt;Context pruning is the second high-leverage change. Rather than carrying every tool output and step result forward indefinitely, summarize older steps into a compact intermediate state. A 500-token summary of steps 1 through 5 is cheaper to carry than the 3,000 tokens of raw outputs from those steps. Build a summarization step every few cycles that compresses old context before it becomes a large fraction of your input cost.&lt;/p&gt;

&lt;p&gt;Prompt caching for the system prompt deserves explicit mention in the agent context. The system prompt is the same on every step of every run. If it is 2,000 tokens, caching it means steps 2 through 20 pay 0.10x the base rate for those tokens instead of 1.00x. On Sonnet 4.6, uncached system prompt cost across 20 steps is 20 times 2,000 divided by 1,000,000 times $3.00 equals $0.12 per run. Cached, it is $0.012 per run. Over 1,000 runs per day, that is $108 per day in savings from one structural change.&lt;/p&gt;

&lt;p&gt;Setting explicit cost budgets per agent run is an operational discipline that most teams defer until they have been surprised by a bill. If you cap each run at $0.50 maximum, an agent that would have escalated to 40 steps terminates at 20 and returns a partial result. Partial results with low confidence are often preferable to silent cost overruns, and they prompt the right conversation about task design.&lt;/p&gt;

&lt;p&gt;The fifth pattern is decomposing complex tasks into independent sub-agents that do not share context. A monolithic 20-step agent that keeps all context in one conversation is the most expensive architecture. If the task has logical segments that can be computed independently and then joined, running them as separate agents, each with its own shorter context, is cheaper than one long chain. The inputs to each sub-agent are smaller, the per-step context is bounded, and you can cache shared system context across agents more effectively.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting This to the Broader Cost Picture
&lt;/h2&gt;

&lt;p&gt;Multi-agent cost management is ultimately an extension of the same principles that govern single-call cost optimization. Fewer tokens per call, cheaper models for simpler steps, and caching for repeated content. The difference is that in agent systems, these principles need to be applied at the architectural level, not just the prompt level.&lt;/p&gt;

&lt;p&gt;For teams building production agent systems, the PromptUnit dashboard shows every request with the model asked for, the model that answered, what it cost and what it saved, so you can see which steps of an agent cost the most.&lt;/p&gt;

&lt;p&gt;For further reading on the cost structure of tool use and function calling in agentic contexts, see &lt;a href="https://www.promptunit.ai/blog/tool-use-function-calling-hidden-cost" rel="noopener noreferrer"&gt;the hidden cost of tool use and function calling&lt;/a&gt;. For a framework to decide when routing to a cheaper model within an agent step is safe, see &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;the LLM model routing guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If your agent infrastructure is costing more than you planned, &lt;a href="https://www.promptunit.ai" rel="noopener noreferrer"&gt;PromptUnit&lt;/a&gt; gives you per-step cost attribution to find out exactly where the tokens are going.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>multiagentai</category>
    </item>
    <item>
      <title>GPT-5.4 vs GPT-5.4 mini: Routing Math After GPT-6</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Tue, 10 Nov 2026 14:00:38 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/gpt-54-vs-gpt-54-mini-routing-math-after-gpt-6-3pm2</link>
      <guid>https://dev.to/scorpion4ik26lang/gpt-54-vs-gpt-54-mini-routing-math-after-gpt-6-3pm2</guid>
      <description>&lt;p&gt;&lt;em&gt;I am the founder of PromptUnit. This post first appeared on the &lt;a href="https://www.promptunit.ai/blog/gpt-5-4-mini-vs-flagship-routing" rel="noopener noreferrer"&gt;PromptUnit blog&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;OpenAI released GPT-5.4 on March 5, 2026 and GPT-5.4 mini on March 17, 2026, according to its &lt;a href="https://developers.openai.com/api/docs/changelog" rel="noopener noreferrer"&gt;API changelog&lt;/a&gt;. Mini costs $0.75 per million input tokens and $4.50 per million output tokens. GPT-5.4 costs $2.50 and $15.00. On both sides that is 30% of the price (0.75 / 2.50 = 0.30 and 4.50 / 15.00 = 0.30), so every request mini can handle costs 70% less.&lt;/p&gt;

&lt;p&gt;GPT-5.4 is no longer the model OpenAI points you to. Its &lt;a href="https://developers.openai.com/api/docs/models" rel="noopener noreferrer"&gt;models page&lt;/a&gt; now says to start with GPT-6 Astra, "our flagship model for complex reasoning and coding," and to choose GPT-6.1 Sol to balance intelligence and cost or GPT-6 Luna for cost-sensitive, high-volume workloads. Plenty of production code still calls &lt;code&gt;gpt-5.4&lt;/code&gt; and &lt;code&gt;gpt-5.4-mini&lt;/code&gt;, though, and neither has a shutdown date on OpenAI's &lt;a href="https://developers.openai.com/api/docs/deprecations" rel="noopener noreferrer"&gt;deprecations page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This post covers the GPT-5.4 versus mini decision first, then the same decision with OpenAI's current models. All prices are OpenAI's standard rates per million tokens for prompts up to 272K input tokens, checked on its &lt;a href="https://developers.openai.com/api/docs/pricing" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt; and model pages on October 30, 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  GPT-5.4 and GPT-5.4 mini side by side
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;GPT-5.4&lt;/th&gt;
&lt;th&gt;GPT-5.4 mini&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;How OpenAI's models page describes it&lt;/td&gt;
&lt;td&gt;"A more affordable model for coding and professional work"&lt;/td&gt;
&lt;td&gt;"Our strongest mini model yet for coding, computer use, and subagents"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Released&lt;/td&gt;
&lt;td&gt;March 5, 2026&lt;/td&gt;
&lt;td&gt;March 17, 2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Input&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-4-mini" rel="noopener noreferrer"&gt;$0.75&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cached input&lt;/td&gt;
&lt;td&gt;$0.25&lt;/td&gt;
&lt;td&gt;$0.075&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Output&lt;/td&gt;
&lt;td&gt;$15.00&lt;/td&gt;
&lt;td&gt;$4.50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Batch input / output&lt;/td&gt;
&lt;td&gt;$1.25 / $7.50&lt;/td&gt;
&lt;td&gt;$0.375 / $2.25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Context window&lt;/td&gt;
&lt;td&gt;1,050,000 tokens&lt;/td&gt;
&lt;td&gt;400,000 tokens (272,000 max input)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max output&lt;/td&gt;
&lt;td&gt;128,000 tokens&lt;/td&gt;
&lt;td&gt;128,000 tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Default reasoning effort&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two details matter for routing. First, mini accepts at most 272,000 input tokens, while GPT-5.4 takes up to 1,050,000. A request above 272K input tokens cannot go to mini at all, and on GPT-5.4 such a prompt is priced at 2x input and 1.5x output for the full session. Second, both models default to reasoning effort &lt;code&gt;none&lt;/code&gt;, so unless your code sets an effort, neither one bills reasoning tokens. That changes with the newer models, as the next sections show.&lt;/p&gt;

&lt;p&gt;OpenAI's model pages list no benchmark scores for either model, so this post does not quote any. Your own traffic is the better test anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where mini is the wrong call
&lt;/h2&gt;

&lt;p&gt;Mini is a cheaper model for a defined set of jobs, not a drop-in replacement for every call. Keep GPT-5.4 when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the prompt is longer than 272,000 input tokens, which mini does not accept;&lt;/li&gt;
&lt;li&gt;the task is long, multi-step reasoning, such as planning several steps ahead or reconciling contradictions across many sources;&lt;/li&gt;
&lt;li&gt;the output is the product a customer reads word for word, and a weaker answer costs more than the saving;&lt;/li&gt;
&lt;li&gt;your own tests show a quality gap on that kind of request.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Mini is worth testing first for classification, intent detection, short summaries, structured extraction (JSON from unstructured text), tagging, reranking retrieved chunks, code completion on well-defined functions, and agent steps where the set of possible actions is small.&lt;/p&gt;

&lt;p&gt;GPT-5.4 nano ($0.20 input, $1.25 output) was the third option for the simplest tasks. OpenAI deprecated it on October 1, 2026. It shuts down on April 1, 2027, and OpenAI recommends &lt;code&gt;gpt-6-luna&lt;/code&gt; as the replacement, so do not build new routing around nano.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cost math: GPT-5.4 vs mini
&lt;/h2&gt;

&lt;p&gt;Take an app that sends 100,000 requests a month, each with 2,000 input tokens and 500 output tokens. That is 200 million input tokens (100,000 x 2,000) and 50 million output tokens (100,000 x 500).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GPT-5.4: 200 x $2.50 = $500 for input, plus 50 x $15.00 = $750 for output, so $1,250 a month.&lt;/li&gt;
&lt;li&gt;GPT-5.4 mini: 200 x $0.75 = $150 for input, plus 50 x $4.50 = $225 for output, so $375 a month.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The difference is $1,250 - $375 = $875 a month, or $875 x 12 = $10,500 a year. That is $875 / $1,250 = 70% of the bill.&lt;/p&gt;

&lt;p&gt;You do not have to move everything. If half of those requests pass your quality test on mini, and they are the same size as the rest, you save half the difference: $875 x 0.5 = $437.50 a month, and the bill drops to $1,250 - $437.50 = $812.50. That is arithmetic on an assumed share, not a forecast. The share that passes depends on your traffic.&lt;/p&gt;

&lt;p&gt;Prompt caching does not change the ratio. Cached input on mini is $0.075 against $0.25 on GPT-5.4, which is also 30% (0.075 / 0.25 = 0.30).&lt;/p&gt;

&lt;h2&gt;
  
  
  The same decision with today's OpenAI models
&lt;/h2&gt;

&lt;p&gt;GPT-6 Astra came out on September 3, 2026, GPT-6 Luna on September 22 and GPT-6.1 Sol on September 29. The GPT-5.6 family (Sol, Terra and Luna) came out on July 9, and OpenAI's model pages map it onto the older tiers: GPT-5.6 Sol "roughly corresponds to the unsuffixed model tier used in earlier GPT-5 families," Terra to the mini tier, and Luna to the nano tier.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;How OpenAI's models page describes it&lt;/th&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Cached input&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;th&gt;Default reasoning effort&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GPT-6 Astra&lt;/td&gt;
&lt;td&gt;"Our most capable model for the most demanding work"&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$50.00&lt;/td&gt;
&lt;td&gt;Not stated; supports low to max, not none&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-6.1 Sol&lt;/td&gt;
&lt;td&gt;"Near-Astra performance for complex work at a lower cost"&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;medium (none and minimal not supported)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-6 Luna&lt;/td&gt;
&lt;td&gt;"Our most efficient model for focused, high-volume tasks"&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-luna" rel="noopener noreferrer"&gt;$0.10&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$0.01&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;td&gt;medium (none supported)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Sol&lt;/td&gt;
&lt;td&gt;"GPT-5.6 flagship model for complex professional work"&lt;/td&gt;
&lt;td&gt;$4.00 (promotional)&lt;/td&gt;
&lt;td&gt;$0.40&lt;/td&gt;
&lt;td&gt;$20.00 (promotional)&lt;/td&gt;
&lt;td&gt;medium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Terra&lt;/td&gt;
&lt;td&gt;"GPT-5.6 model that balances intelligence and cost"&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$0.20&lt;/td&gt;
&lt;td&gt;$12.00&lt;/td&gt;
&lt;td&gt;medium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Luna&lt;/td&gt;
&lt;td&gt;"GPT-5.6 model optimized for cost-sensitive workloads"&lt;/td&gt;
&lt;td&gt;$0.20&lt;/td&gt;
&lt;td&gt;$0.02&lt;/td&gt;
&lt;td&gt;$1.20&lt;/td&gt;
&lt;td&gt;medium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.4&lt;/td&gt;
&lt;td&gt;"A more affordable model for coding and professional work"&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;$0.25&lt;/td&gt;
&lt;td&gt;$15.00&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.4 mini&lt;/td&gt;
&lt;td&gt;"Our strongest mini model yet for coding, computer use, and subagents"&lt;/td&gt;
&lt;td&gt;$0.75&lt;/td&gt;
&lt;td&gt;$0.075&lt;/td&gt;
&lt;td&gt;$4.50&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;GPT-5.6 Sol's price is promotional. OpenAI lowered it on August 21, 2026 (20% lower input, 33% lower output) and says the promotional pricing is available at least through November 30, 2026. The GPT-6 and GPT-5.6 models also charge for cache writes, at 1.25 times the input price. OpenAI's pricing page lists no cache-write price for GPT-5.4 or mini.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reasoning effort changes the math
&lt;/h3&gt;

&lt;p&gt;GPT-5.4 and mini default to effort &lt;code&gt;none&lt;/code&gt;. GPT-6.1 Sol, GPT-6 Luna and all three GPT-5.6 models default to &lt;code&gt;medium&lt;/code&gt;, according to their model pages and OpenAI's &lt;a href="https://developers.openai.com/api/docs/guides/reasoning" rel="noopener noreferrer"&gt;reasoning guide&lt;/a&gt;. GPT-6 Astra's model page lists &lt;code&gt;low&lt;/code&gt;, &lt;code&gt;medium&lt;/code&gt;, &lt;code&gt;high&lt;/code&gt;, &lt;code&gt;xhigh&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt; but does not name a default, so set it explicitly. The guide is clear about billing: reasoning tokens are not visible through the API, but they "are billed as output tokens." It also says a request can use "anywhere from a few hundred to tens of thousands of reasoning tokens," and the real count is in the response's usage object under &lt;code&gt;output_tokens_details&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So if you swap &lt;code&gt;gpt-5.4&lt;/code&gt; for a newer model name and change nothing else, you go from zero reasoning tokens to medium effort, and you pay for that thinking at the output rate.&lt;/p&gt;

&lt;p&gt;Here is the same workload as above: 100,000 requests a month, 200 million input tokens and 50 million visible output tokens. The last column assumes 1,000 reasoning tokens per request, which adds 100,000 x 1,000 = 100 million output tokens (150 million in total). That figure is an illustration only. Measure your own.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;No reasoning tokens&lt;/th&gt;
&lt;th&gt;With 1,000 reasoning tokens per request&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GPT-6 Astra&lt;/td&gt;
&lt;td&gt;200 x $10 + 50 x $50 = $2,000 + $2,500 = $4,500&lt;/td&gt;
&lt;td&gt;$2,000 + 150 x $50 = $2,000 + $7,500 = $9,500&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-6.1 Sol&lt;/td&gt;
&lt;td&gt;200 x $2 + 50 x $10 = $400 + $500 = $900&lt;/td&gt;
&lt;td&gt;$400 + 150 x $10 = $400 + $1,500 = $1,900&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-6 Luna&lt;/td&gt;
&lt;td&gt;200 x $0.10 + 50 x $0.50 = $20 + $25 = $45&lt;/td&gt;
&lt;td&gt;$20 + 150 x $0.50 = $20 + $75 = $95&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Sol&lt;/td&gt;
&lt;td&gt;200 x $4 + 50 x $20 = $800 + $1,000 = $1,800&lt;/td&gt;
&lt;td&gt;$800 + 150 x $20 = $800 + $3,000 = $3,800&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Terra&lt;/td&gt;
&lt;td&gt;200 x $2 + 50 x $12 = $400 + $600 = $1,000&lt;/td&gt;
&lt;td&gt;$400 + 150 x $12 = $400 + $1,800 = $2,200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Luna&lt;/td&gt;
&lt;td&gt;200 x $0.20 + 50 x $1.20 = $40 + $60 = $100&lt;/td&gt;
&lt;td&gt;$40 + 150 x $1.20 = $40 + $180 = $220&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.4&lt;/td&gt;
&lt;td&gt;$500 + $750 = $1,250&lt;/td&gt;
&lt;td&gt;$1,250 at its default (none)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.4 mini&lt;/td&gt;
&lt;td&gt;$150 + $225 = $375&lt;/td&gt;
&lt;td&gt;$375 at its default (none)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three things stand out.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A lower price per token is not always a lower bill.&lt;/strong&gt; With no reasoning tokens, GPT-6.1 Sol ($900) costs less than GPT-5.4 ($1,250). At its medium default with 1,000 reasoning tokens per request, it costs $1,900, which is more than GPT-5.4 at its default. GPT-6.1 Sol does not accept &lt;code&gt;none&lt;/code&gt;; &lt;code&gt;low&lt;/code&gt; is its lowest setting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT-5.6 Terra is not the cheaper step down from mini.&lt;/strong&gt; OpenAI calls it the mini-tier model of the GPT-5.6 family, yet it costs more per token than GPT-5.4 mini ($2.00 against $0.75 input, $12.00 against $4.50 output). On this workload that is $1,000 against $375 with no reasoning tokens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT-6 Luna is.&lt;/strong&gt; Per token it costs $0.10 / $0.75 = 13% of mini's input price and $0.50 / $4.50 = 11% of its output price. On this workload it is $45 against $375 with no reasoning tokens ($45 / $375 = 12%, so 88% less), and $95 even with 1,000 reasoning tokens per request. Luna accepts &lt;code&gt;none&lt;/code&gt;, so you can compare it with mini at the same setting. In Chat Completions, Luna supports function calling only with &lt;code&gt;reasoning_effort&lt;/code&gt; set to &lt;code&gt;none&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Astra is the hardest one to price from a table. OpenAI's &lt;a href="https://developers.openai.com/api/docs/guides/latest-model" rel="noopener noreferrer"&gt;GPT-6 guide&lt;/a&gt; says that in several evaluations Astra "achieved stronger results using substantially fewer output tokens," and that its estimated API cost per task was lower than earlier models despite its higher per-token price. That is OpenAI's claim about its own evaluations. Whether it holds for your requests is something the token counts in your usage logs will tell you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which pairs to test
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPT-6 Astra to GPT-6.1 Sol.&lt;/strong&gt; OpenAI itself says to "Compare it with Astra on your tasks to assess the tradeoff between quality and cost." Per token, 6.1 Sol is 20% of Astra's price on both input ($2 / $10) and output ($10 / $50), so 80% less, and its cached input is $0.10 against $1.00.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT-6.1 Sol to GPT-6 Luna.&lt;/strong&gt; This is the GPT-6 version of the flagship-to-mini question. Luna is 5% of 6.1 Sol's price per token ($0.10 / $2.00 and $0.50 / $10.00), so 95% less.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT-5.4 to GPT-5.4 mini.&lt;/strong&gt; Still 70% less per token if you stay on the 5.4 models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT-5.4 mini to GPT-6 Luna.&lt;/strong&gt; Per token, Luna costs about 87% less on input (1 - 0.10 / 0.75) and about 89% less on output (1 - 0.50 / 4.50).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In every pair, keep the reasoning effort the same on both sides, or you end up measuring reasoning tokens instead of models. OpenAI's &lt;a href="https://developers.openai.com/api/docs/guides/model-selection" rel="noopener noreferrer"&gt;model selection guide&lt;/a&gt; gives starting points that pair a model with an effort level, from Luna at low effort for "simple data extraction" up to Astra at extra high for "demanding analysis and complex deliverables with exacting requirements."&lt;/p&gt;

&lt;h2&gt;
  
  
  What we saw on our own traffic
&lt;/h2&gt;

&lt;p&gt;Our first-party data on GPT-5.4 mini is small. The requests it covers were sent to Claude Sonnet 5, not to GPT-5.4, so it shows how mini did against Sonnet 5 on those requests. It is not a GPT-5.4 versus mini test.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In one app the PromptUnit team runs itself (checks up to October 12, 2026), GPT-5.4 mini was judged as good in 23 of 23 checks on the app's video-prompt step, at about 73% lower cost.&lt;/li&gt;
&lt;li&gt;In 24 side-by-side comparisons on one production account (October 5 to 7, 2026), Claude Sonnet 5 to GPT-5.4 mini matched 8 of 10.&lt;/li&gt;
&lt;li&gt;Not every step moves. On the same team app's web-research step, Claude Haiku 4.5 had served for five days with no errors and answers that passed the automatic format checks, yet it was judged worse than Sonnet 5 in 2 of 3 checks, so PromptUnit stopped moving that step and kept it on Sonnet 5.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In each case the judge was Claude Sonnet 5, the model the app asked for, so the judge is not independent, and the samples are small. Treat this as early data, not as a quality guarantee for your traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to do next
&lt;/h2&gt;

&lt;p&gt;Pull a week of requests from your logs and group them by feature or step. For each group, send 20 real requests to both the model you use now and the cheaper candidate, at the same reasoning effort, and compare the answers with whatever quality check your team already uses: an eval pass rate, a human rating, or a match against expected output. Record input, output and reasoning tokens for both, because the cheaper model per token is not always cheaper per request. Any group where the cheaper model meets your bar is a candidate to move.&lt;/p&gt;

&lt;p&gt;If you would rather not run that bake-off by hand, PromptUnit checks each request and uses a cheaper model, such as GPT-5.4 mini, when one is just as good for that request. Otherwise the request goes to the model you asked for. Setup is two settings: point your app's API base URL at PromptUnit and add your PromptUnit key. Your own OpenAI key stays.&lt;/p&gt;

&lt;p&gt;Its optional side-by-side checks are off by default and run on your own provider keys within a daily budget you set. After your app has its answer, cheaper models answer a sample of real requests, and the model you asked for judges whether each cheaper answer is as good. A step of your app moves to a cheaper model on its own only after at least 20 judged checks with 9 in 10 as good and at least 10% lower cost, and it moves back if fewer than 7 in 10 stay as good. The dashboard shows each request with the model asked for, the model that answered, its cost and its saving.&lt;/p&gt;

&lt;p&gt;It is free until it has saved you $5 (individual accounts) or $100 (business accounts with a work email), then it takes 20% of the savings. If it saves nothing, you pay nothing.&lt;/p&gt;




&lt;h2&gt;
  
  
  See Also
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;LLM Routing: How It Works, Strategies and Real Data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/openai-api-too-expensive-what-to-do" rel="noopener noreferrer"&gt;OpenAI API Cost Too High? Six Fixes, Ordered by Effort&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/hidden-cost-of-defaulting-to-gpt4" rel="noopener noreferrer"&gt;The Hidden Cost of Defaulting to Your Flagship Model&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Try It Free
&lt;/h2&gt;

&lt;p&gt;See where your AI budget goes. PromptUnit shows every request with the model you asked for, the model that answered, what it cost and what it saved.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.promptunit.ai/sign-up" rel="noopener noreferrer"&gt;Start free&lt;/a&gt;. It costs nothing until it has saved you money.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How much cheaper is GPT-5.4 mini than GPT-5.4?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;GPT-5.4 mini costs $0.75 per million input tokens and $4.50 per million output tokens, against $2.50 and $15.00 for GPT-5.4 (OpenAI standard prices, checked 2026-11-05). That is 30% of the price on both sides, or 70% less per token. For 100,000 requests a month with 2,000 input and 500 output tokens each, GPT-5.4 costs $1,250 and GPT-5.4 mini costs $375.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is GPT-5.4 still OpenAI's flagship model?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. As of 2026-10-12, OpenAI's models page says to start with GPT-6 Astra, its flagship model for complex reasoning and coding, and to choose GPT-6.1 Sol to balance intelligence and cost or GPT-6 Luna for cost-sensitive, high-volume work. GPT-5.4 and GPT-5.4 mini are still listed and have no shutdown date on OpenAI's deprecations page. GPT-5.4 nano is deprecated and shuts down on April 1, 2027.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which OpenAI model is cheaper than GPT-5.4 mini today?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Per token, GPT-6 Luna at $0.10 input and $0.50 output per million tokens costs less than GPT-5.4 mini at $0.75 and $4.50. GPT-5.6 Terra, which OpenAI says roughly corresponds to the earlier mini tier, costs more at $2.00 and $12.00. Luna defaults to medium reasoning effort while GPT-5.4 mini defaults to none, and reasoning tokens are billed as output, so compare the cost per request on your own traffic, not only the price per token.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do reasoning tokens cost extra on OpenAI models?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They are billed as output tokens. GPT-5.4 and GPT-5.4 mini default to reasoning effort none, so they bill no reasoning tokens unless you set an effort. GPT-6.1 Sol, GPT-6 Luna and the GPT-5.6 models default to medium. On GPT-6.1 Sol, 1,000 reasoning tokens add 1,000 x $10 / 1,000,000 = $0.01 to a request. The real count is in the usage object of each response.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is GPT-5.6 Sol's $4 and $20 price permanent?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. OpenAI cut GPT-5.6 Sol to $4 per million input tokens and $20 per million output tokens on August 21, 2026, and its pricing page says this promotional pricing is available at least through November 30, 2026 (checked 2026-11-05).&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>llmcostoptimization</category>
    </item>
    <item>
      <title>LLM Cost Tracking: Per Request, Feature and User (2026)</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Fri, 06 Nov 2026 14:00:38 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/llm-cost-tracking-per-request-feature-and-user-2026-4kdb</link>
      <guid>https://dev.to/scorpion4ik26lang/llm-cost-tracking-per-request-feature-and-user-2026-4kdb</guid>
      <description>&lt;p&gt;&lt;em&gt;I am the founder of PromptUnit. This post first appeared on the &lt;a href="https://www.promptunit.ai/blog/llm-cost-tracking-guide" rel="noopener noreferrer"&gt;PromptUnit blog&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;LLM cost tracking means recording what every model call costs, together with the feature, user, model and environment that caused it, so you can see where AI spend comes from and act on it. Without it, cost work is guesswork.&lt;/p&gt;

&lt;p&gt;Most teams start with a monthly invoice from OpenAI or Anthropic and no visibility beneath that number. The invoice tells you what you spent. It does not tell you which feature drove the spike last Tuesday, which model is responsible for 70% of your bill, or whether your costs grow in step with your users or faster.&lt;/p&gt;

&lt;p&gt;This guide covers what to track, a cost function you can copy, how to get cost per user, the tools that can do it for you, and what to do when costs move. Provider prices, spend limits and tool features were checked on October 30, 2026.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Core Metrics to Track
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Cost per feature
&lt;/h3&gt;

&lt;p&gt;The most actionable dimension for engineering teams. When you can see that Feature A costs $0.008 per call and Feature B costs $0.47 per call, you know where to focus.&lt;/p&gt;

&lt;p&gt;This requires tagging every LLM call with the feature that generated it, in your logging code or with a request header if you use a proxy. &lt;a href="https://www.promptunit.ai/blog/llm-cost-attribution-by-feature" rel="noopener noreferrer"&gt;LLM cost attribution by feature&lt;/a&gt; shows what OpenAI and Anthropic can and cannot group by, and how to tag requests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cost per user (or tenant)
&lt;/h3&gt;

&lt;p&gt;For SaaS products, per-user LLM cost is the base of your unit economics. If your average customer generates $12/month in LLM costs but pays you $29/month, your AI margin is thin. If one customer generates $200/month in costs, the monthly invoice will not tell you who it is. The per-user section below has the queries.&lt;/p&gt;

&lt;p&gt;User-level cost tracking also supports fair-use policies, per-plan rate limits and pricing decisions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Model distribution
&lt;/h3&gt;

&lt;p&gt;What share of your calls goes to each model? If 90% of calls go to your most expensive model, check whether every one of them needs it. If you recently moved some traffic to a cheaper model, model distribution tells you whether the change is working as intended.&lt;/p&gt;

&lt;p&gt;Tracking model distribution over time also surfaces drift: as new features ship, they may default to an expensive model without going through a cost review.&lt;/p&gt;

&lt;h3&gt;
  
  
  Task type breakdown
&lt;/h3&gt;

&lt;p&gt;Which task types are most common in your traffic? What is the average cost per task type? Tasks that are both high-volume and simple are the first place to test a cheaper model.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cost per environment
&lt;/h3&gt;

&lt;p&gt;Separate tracking for production, staging and development is basic hygiene. A cost spike in development (a developer testing with a long context window, a test suite making more calls than expected) should not stay invisible until the invoice arrives.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cache hit rate
&lt;/h3&gt;

&lt;p&gt;Cached input is billed at a fraction of the normal input price, so the share of input tokens read from the cache moves your bill. OpenAI's prompt caching guide suggests dividing total cached tokens by total input tokens and grouping by user, workspace or day. A drop often means something near the start of the prompt began changing between calls. &lt;a href="https://www.promptunit.ai/blog/prompt-caching-cost-savings-openai-anthropic" rel="noopener noreferrer"&gt;Prompt caching on OpenAI and Anthropic&lt;/a&gt; covers how each provider caches.&lt;/p&gt;

&lt;h3&gt;
  
  
  Latency by model
&lt;/h3&gt;

&lt;p&gt;Cost and latency are related. Smaller models are often faster. Tracking latency per model per task type shows user-facing performance next to cost when you decide which model a feature should use.&lt;/p&gt;




&lt;h2&gt;
  
  
  Setting Up Cost Monitoring
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Option 1: Log every call with one cost function
&lt;/h3&gt;

&lt;p&gt;The basic approach: every LLM call is logged with its cost and metadata when it is made. The cost has to come from the usage object the provider returns, priced per model, and it has to handle cached tokens.&lt;/p&gt;

&lt;p&gt;OpenAI and Anthropic report cached tokens differently. In OpenAI's Responses API, &lt;code&gt;input_tokens&lt;/code&gt; includes the tokens read from the cache and the tokens written to it. In Anthropic's Messages API, &lt;code&gt;input_tokens&lt;/code&gt; counts only the tokens after the last cache breakpoint, and cache reads and writes come in separate fields. A function that ignores this overstates the cost of cached calls on OpenAI and understates it on Anthropic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timezone&lt;/span&gt;

&lt;span class="c1"&gt;# USD per 1M tokens, standard tier, from each provider's pricing page on October 16, 2026.
# OpenAI rows are for prompts up to 272K input tokens.
# Claude Haiku 5.5 row is for prompts up to 100,000 tokens.
# Claude cache_write is the 5-minute cache; 1-hour cache writes cost more.
&lt;/span&gt;&lt;span class="n"&gt;PRICES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-6.1-sol&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;       &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cached&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_write&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;10.00&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-6-sol&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;         &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cached&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_write&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;10.00&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-6-luna&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cached&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_write&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.125&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.50&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-sonnet-5-5&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cached&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_write&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;10.00&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-haiku-5-5&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cached&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_write&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.125&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.50&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;cost_usd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PRICES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;  &lt;span class="c1"&gt;# KeyError on purpose: an unknown model must not be logged at $0
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;openai&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Responses API: input_tokens includes cached and cache-write tokens.
&lt;/span&gt;        &lt;span class="c1"&gt;# output_tokens includes reasoning tokens, which are billed as output.
&lt;/span&gt;        &lt;span class="n"&gt;details&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_tokens_details&lt;/span&gt;
        &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cached_tokens&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
        &lt;span class="n"&gt;written&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getattr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;details&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_write_tokens&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
        &lt;span class="n"&gt;uncached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_tokens&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;written&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;anthropic&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Messages API: input_tokens counts only tokens after the last cache breakpoint.
&lt;/span&gt;        &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cache_read_input_tokens&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
        &lt;span class="n"&gt;written&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cache_creation_input_tokens&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
        &lt;span class="n"&gt;uncached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_tokens&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;no usage mapping for &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;uncached&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cached&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;written&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_write&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_tokens&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1_000_000&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;log_call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;feature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;log_event&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ts&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timezone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;utc&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;isoformat&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;provider&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;feature&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;feature&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;usage&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model_dump&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;  &lt;span class="c1"&gt;# raw counts, for later analysis
&lt;/span&gt;        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cost_usd&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;cost_usd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The prices come from &lt;a href="https://developers.openai.com/api/docs/pricing" rel="noopener noreferrer"&gt;OpenAI's pricing page&lt;/a&gt; and &lt;a href="https://platform.claude.com/docs/en/about-claude/pricing" rel="noopener noreferrer"&gt;Anthropic's pricing page&lt;/a&gt;. Our price pages for &lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-1-sol" rel="noopener noreferrer"&gt;GPT-6.1 Sol&lt;/a&gt;, &lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-sol" rel="noopener noreferrer"&gt;GPT-6 Sol&lt;/a&gt;, &lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-luna" rel="noopener noreferrer"&gt;GPT-6 Luna&lt;/a&gt;, &lt;a href="https://www.promptunit.ai/ai-api-pricing/claude-sonnet-5-5" rel="noopener noreferrer"&gt;Claude Sonnet 5.5&lt;/a&gt; and &lt;a href="https://www.promptunit.ai/ai-api-pricing/claude-haiku-5-5" rel="noopener noreferrer"&gt;Claude Haiku 5.5&lt;/a&gt; show today's numbers.&lt;/p&gt;

&lt;p&gt;An example of why the cache fields matter: a Claude Sonnet 5.5 call with 10,000 input tokens read from the cache, 2,000 uncached input tokens and 500 output tokens costs (2,000 x $2.00 + 10,000 x $0.10 + 500 x $10.00) / 1,000,000 = $0.0100. The same call with no cache would cost (12,000 x $2.00 + 500 x $10.00) / 1,000,000 = $0.0290.&lt;/p&gt;

&lt;p&gt;Keep the price table in one place and update it when prices change. Long prompts are priced higher on some models (over 272K input tokens on OpenAI's newer models, over 100,000 tokens on Claude Haiku 5.5), so add those tiers if your prompts get that long.&lt;/p&gt;

&lt;p&gt;This approach works, but every call site must pass the feature and the user. It is easy to miss one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 2: A wrapper that every call goes through
&lt;/h3&gt;

&lt;p&gt;A better approach is to make the wrapper the only way your app calls a model, so no call is made without attribution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TrackedClient&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;The only path to the model, so no call goes unlogged.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;feature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;feature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;feature&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;respond&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;kwargs&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;kwargs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;log_call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;openai&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;feature&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;


&lt;span class="n"&gt;summaries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TrackedClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;openai_client&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;feature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ticket-summary&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Option 3: A proxy or gateway
&lt;/h3&gt;

&lt;p&gt;A proxy or gateway sits in the request path and records every call, so there is no logging code at each call site. You change the API base URL and send the feature or user as request headers. Helicone's AI Gateway, the LiteLLM proxy and PromptUnit work this way; the tools table below shows what each one records. The trade-off is one more service between your app and the provider.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to Track LLM Cost per User
&lt;/h2&gt;

&lt;p&gt;Provider usage reports are built around your account structure, not the users of your app. Anthropic's usage report, for example, groups by API key, workspace, model and a few service settings, not by the user a request was made for. Per-user cost has to come from your own logs or from a tool that reads a user id from each request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Pass a user id with every call.&lt;/strong&gt; Use your internal user id (a UUID from your database), not an email address. In your own logs it is a column, as in the &lt;code&gt;log_call&lt;/code&gt; function above. If you use a gateway, send it the way the gateway expects: Helicone reads the &lt;code&gt;Helicone-User-Id&lt;/code&gt; header, LiteLLM reads the &lt;code&gt;x-litellm-customer-id&lt;/code&gt; header or the request's &lt;code&gt;user&lt;/code&gt; field, and Langfuse takes a &lt;code&gt;userId&lt;/code&gt; on traces. One user action in an agent can make several model calls, so log the same id on all of them. &lt;a href="https://www.promptunit.ai/blog/multi-agent-llm-cost-spiral" rel="noopener noreferrer"&gt;The multi-agent cost spiral&lt;/a&gt; explains why those calls add up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Group by user and day.&lt;/strong&gt; With calls stored in a table such as &lt;code&gt;llm_calls (ts, user_id, feature, model, cost_usd)&lt;/code&gt;, this Postgres query gives daily cost per user for the last 30 days:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;date_trunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'day'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="k"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="k"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;              &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;calls&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cost_usd&lt;/span&gt;&lt;span class="p"&gt;)::&lt;/span&gt;&lt;span class="nb"&gt;numeric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;spend_usd&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;llm_calls&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;ts&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;interval&lt;/span&gt; &lt;span class="s1"&gt;'30 days'&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;day&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;day&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;spend_usd&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Compare with what the user pays.&lt;/strong&gt; Join to your users and plans to see AI cost as a share of each paying user's price:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;monthly_price_usd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cost_usd&lt;/span&gt;&lt;span class="p"&gt;)::&lt;/span&gt;&lt;span class="nb"&gt;numeric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;ai_cost_30d&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;round&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cost_usd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;monthly_price_usd&lt;/span&gt;&lt;span class="p"&gt;)::&lt;/span&gt;&lt;span class="nb"&gt;numeric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;pct_of_price&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;llm_calls&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;plans&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plan&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ts&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;interval&lt;/span&gt; &lt;span class="s1"&gt;'30 days'&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;monthly_price_usd&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;monthly_price_usd&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;pct_of_price&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A user on a $29 plan with $12 of AI cost in 30 days spends 41% of their price on AI alone (12 / 29). Free users have no price to divide by, so list them separately, sorted by cost. Pick a threshold that fits your margins and review everyone above it. &lt;a href="https://www.promptunit.ai/blog/ai-cost-per-user-saas-unit-economics" rel="noopener noreferrer"&gt;AI cost per user&lt;/a&gt; covers how to set that threshold from your revenue per user.&lt;/p&gt;




&lt;h2&gt;
  
  
  Best LLM Cost Tracking Tools in 2026
&lt;/h2&gt;

&lt;p&gt;Each option below reports LLM cost. They differ in how they get the data, how finely they can split it, and whether they can stop spending or only report it. Every cell comes from the tool's own documentation, checked October 16, 2026. PromptUnit is our product, and its row lists only what this post documents.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Per user&lt;/th&gt;
&lt;th&gt;Per feature or tag&lt;/th&gt;
&lt;th&gt;Budget enforcement&lt;/th&gt;
&lt;th&gt;How it captures data&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Langfuse&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;userId&lt;/code&gt; on traces; cost aggregated per user&lt;/td&gt;
&lt;td&gt;Tags and metadata; dashboards can split cost by tag&lt;/td&gt;
&lt;td&gt;Alerts on cost thresholds, filterable by user or tag; it is not in the request path, so it does not block calls&lt;/td&gt;
&lt;td&gt;SDKs (OpenTelemetry based) send traces in the background&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Helicone&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Helicone-User-Id&lt;/code&gt; header&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Helicone-Property-[Name]&lt;/code&gt; headers&lt;/td&gt;
&lt;td&gt;Cost-based rate limits per user or per property (&lt;code&gt;Helicone-RateLimit-Policy&lt;/code&gt; with &lt;code&gt;u=cents&lt;/code&gt;), plus cost alerts&lt;/td&gt;
&lt;td&gt;AI Gateway (change the base URL), or its Manual Logger&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LiteLLM proxy&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;x-litellm-customer-id&lt;/code&gt; header or the &lt;code&gt;user&lt;/code&gt; field; also internal users and teams&lt;/td&gt;
&lt;td&gt;Tags via the &lt;code&gt;x-litellm-tags&lt;/code&gt; header, request metadata or the virtual key&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;max_budget&lt;/code&gt; per virtual key, internal user, team, customer and tag; calls over budget are rejected&lt;/td&gt;
&lt;td&gt;A proxy you run, with a database for spend logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Provider consoles (OpenAI, Anthropic, Google)&lt;/td&gt;
&lt;td&gt;Only with one key, project or workspace per user&lt;/td&gt;
&lt;td&gt;Only with one key, project or workspace per feature&lt;/td&gt;
&lt;td&gt;Monthly hard limits per organization or project (OpenAI), per workspace (Anthropic), per project (Google, experimental)&lt;/td&gt;
&lt;td&gt;Built in; nothing to install&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PromptUnit&lt;/td&gt;
&lt;td&gt;No per-user view&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;x-promptunit-feature&lt;/code&gt; header; requests are also grouped into your app's steps&lt;/td&gt;
&lt;td&gt;Not covered in this post&lt;/td&gt;
&lt;td&gt;Proxy: two settings (API base URL and a PromptUnit key); your provider key stays&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Sources: Langfuse &lt;a href="https://langfuse.com/docs/observability/features/token-and-cost-tracking" rel="noopener noreferrer"&gt;cost tracking&lt;/a&gt;, &lt;a href="https://langfuse.com/docs/observability/features/users" rel="noopener noreferrer"&gt;users&lt;/a&gt;, &lt;a href="https://langfuse.com/docs/observability/features/tags" rel="noopener noreferrer"&gt;tags&lt;/a&gt; and &lt;a href="https://langfuse.com/docs/observability/features/alerts" rel="noopener noreferrer"&gt;alerts&lt;/a&gt;; Helicone &lt;a href="https://docs.helicone.ai/helicone-headers/header-directory" rel="noopener noreferrer"&gt;header directory&lt;/a&gt;, &lt;a href="https://docs.helicone.ai/features/advanced-usage/custom-properties" rel="noopener noreferrer"&gt;custom properties&lt;/a&gt;, &lt;a href="https://docs.helicone.ai/features/advanced-usage/custom-rate-limits" rel="noopener noreferrer"&gt;rate limits&lt;/a&gt; and &lt;a href="https://docs.helicone.ai/features/alerts" rel="noopener noreferrer"&gt;alerts&lt;/a&gt;; LiteLLM &lt;a href="https://docs.litellm.ai/docs/proxy/customers" rel="noopener noreferrer"&gt;customers&lt;/a&gt;, &lt;a href="https://docs.litellm.ai/docs/proxy/tag_budgets" rel="noopener noreferrer"&gt;tag budgets&lt;/a&gt;, &lt;a href="https://docs.litellm.ai/docs/proxy/users" rel="noopener noreferrer"&gt;budgets&lt;/a&gt; and &lt;a href="https://docs.litellm.ai/docs/proxy/cost_tracking" rel="noopener noreferrer"&gt;spend tracking&lt;/a&gt;; &lt;a href="https://developers.openai.com/api/docs/guides/spend-limits" rel="noopener noreferrer"&gt;OpenAI spend limits&lt;/a&gt;, &lt;a href="https://platform.claude.com/docs/en/manage-claude/workspaces" rel="noopener noreferrer"&gt;Anthropic workspaces&lt;/a&gt;, &lt;a href="https://ai.google.dev/gemini-api/docs/billing" rel="noopener noreferrer"&gt;Gemini API billing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;How to choose: if you need to stop one user's or one feature's spending, Helicone's cost-based rate limits and LiteLLM's budgets do it in the request path. Langfuse alerts you but leaves the call alone. The provider consoles cap a whole project or workspace. For a closer look at two of these, see &lt;a href="https://www.promptunit.ai/blog/promptunit-vs-helicone" rel="noopener noreferrer"&gt;PromptUnit vs Helicone&lt;/a&gt; and &lt;a href="https://www.promptunit.ai/blog/promptunit-vs-langfuse" rel="noopener noreferrer"&gt;PromptUnit vs Langfuse&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Alerting Setup
&lt;/h2&gt;

&lt;p&gt;Cost tracking is only useful if anomalies surface in time to act. The providers cover the first alert type below: OpenAI sends spend alerts at amounts you set on its Limits page, and Anthropic can alert when a workspace's spending reaches thresholds you set. The other two need your own logs or a tool from the table above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Absolute cost threshold
&lt;/h3&gt;

&lt;p&gt;Alert when spend in the current billing period exceeds a fixed dollar amount. Set it at 80% of your expected monthly budget.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Alert: Monthly LLM spend has exceeded $4,000 (80% of $5,000 budget)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Percentage increase vs rolling average
&lt;/h3&gt;

&lt;p&gt;Alert when daily or hourly cost is well above the rolling 7-day or 30-day average. This catches spikes that do not hit absolute thresholds but show that something changed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Alert: LLM spend in the last 1 hour is 3.2x the 7-day hourly average
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This type of alert is most effective for catching unexpected traffic increases, runaway loops, or new features calling expensive models at high volume.&lt;/p&gt;

&lt;h3&gt;
  
  
  Per-feature cost anomaly
&lt;/h3&gt;

&lt;p&gt;Alert when a specific feature's cost per call rises sharply. A 5x increase in cost per call for a feature usually points to a prompt change, a context window change, or a model change that was not cost-reviewed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Alert: Feature "document_analysis" average cost per call increased 4.7x
(from $0.023 to $0.108) in the last 24 hours
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Cost Anomaly Detection
&lt;/h2&gt;

&lt;p&gt;Common causes of unexpected cost spikes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;New feature launched without a cost estimate.&lt;/strong&gt; A feature that generates long outputs, uses a long context window, or chains several model calls can cost many times more per call than a typical feature. If cost estimation is not part of the feature review, the first signal is the invoice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt change increased output length.&lt;/strong&gt; A prompt that used to produce 200-token responses now produces 800-token responses after an edit. Output tokens cost more than input tokens on every major provider: five times on OpenAI's GPT-6 models (for prompts up to 272K tokens) and six times on GPT-5.6 Terra and GPT-5.4, five times on Anthropic's current Claude models, and from five times on &lt;a href="https://www.promptunit.ai/ai-api-pricing/gemini-3-8-flash" rel="noopener noreferrer"&gt;Gemini 3.8 Flash&lt;/a&gt; to about eight times on &lt;a href="https://www.promptunit.ai/ai-api-pricing/gemini-3-5-flash-lite" rel="noopener noreferrer"&gt;Gemini 3.5 Flash-Lite&lt;/a&gt;. OpenAI bills reasoning tokens as output, and Google's output price includes thinking tokens. So output length has an outsized effect on cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context window growth over time.&lt;/strong&gt; For multi-turn conversation features, context grows with each turn. A conversation that started at 500 tokens per call may be at 8,000 tokens after 20 turns. If your application does not trim or summarize conversation history, per-call cost keeps growing over a session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Model change without a cost review.&lt;/strong&gt; Moving a feature from GPT-6 Luna to GPT-6.1 Sol, or from Claude Haiku 5.5 to Claude Sonnet 5.5, multiplies the per-token price by 20 on both input and output ($0.10 to $2.00 per million input tokens, $0.50 to $10.00 per million output tokens). If cost monitoring does not flag the change, it stays invisible until the invoice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Runaway agent loop.&lt;/strong&gt; Agent workflows that call tools and retry can make far more model calls than planned. A bug that makes an agent loop, or a task harder than the retry budget assumed, can multiply the call count.&lt;/p&gt;

&lt;p&gt;For a way to turn calls and tokens into a monthly bill, see &lt;a href="https://www.promptunit.ai/blog/openai-api-too-expensive-what-to-do" rel="noopener noreferrer"&gt;OpenAI API Cost Too High? Six Fixes, Ordered by Effort&lt;/a&gt;. For what defaulting to one expensive model costs beyond the invoice, see &lt;a href="https://www.promptunit.ai/blog/hidden-cost-of-defaulting-to-gpt4" rel="noopener noreferrer"&gt;The Hidden Cost of Defaulting to Your Flagship Model&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Budget Enforcement
&lt;/h2&gt;

&lt;p&gt;Tracking tells you what happened. Enforcement stops it from happening again.&lt;/p&gt;

&lt;h3&gt;
  
  
  Provider spend limits
&lt;/h3&gt;

&lt;p&gt;All three large providers let you cap monthly spend, but none of them does it per API key:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI:&lt;/strong&gt; a monthly spend limit for the whole organization or for one project. With "Enforce a hard limit" on, requests over the limit get a &lt;code&gt;429&lt;/code&gt; error with the code &lt;code&gt;organization_spend_limit_exceeded&lt;/code&gt; or &lt;code&gt;project_spend_limit_exceeded&lt;/code&gt;. Enforcement is not instant, so recorded spend can slightly exceed the limit. (&lt;a href="https://developers.openai.com/api/docs/guides/spend-limits" rel="noopener noreferrer"&gt;OpenAI spend limits&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anthropic:&lt;/strong&gt; a monthly spend limit per workspace, set in the Claude Console under Settings &amp;gt; Workspaces. It can be lower than the organization's limit but not higher, and the Default Workspace cannot have its own limit. (&lt;a href="https://platform.claude.com/docs/en/manage-claude/workspaces" rel="noopener noreferrer"&gt;Anthropic workspaces&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google:&lt;/strong&gt; a monthly spend cap per project, set on the Spend page in AI Studio. Google marks it as experimental and says spend can run past the cap for about 10 minutes while billing data catches up. Billing accounts on paid tiers also have a monthly cap ($250 on Tier 1, for example); when it is reached, all linked projects pause until the 1st of the next month. (&lt;a href="https://ai.google.dev/gemini-api/docs/billing" rel="noopener noreferrer"&gt;Gemini API billing&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The risk: one cap covers everything in the project or workspace, so a single runaway feature can block every other feature that shares it. Giving each critical feature its own project or workspace limits the damage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Per-feature limits
&lt;/h3&gt;

&lt;p&gt;Enforce limits at the feature level in your application or gateway. A feature expected to make 10,000 calls a day at $0.05 per call should stop accepting new requests after 12,000 calls. LiteLLM's tag budgets and Helicone's per-property rate limits do this in a gateway.&lt;/p&gt;

&lt;h3&gt;
  
  
  Per-user spending limits
&lt;/h3&gt;

&lt;p&gt;For multi-tenant or consumer-facing products, enforce a per-user LLM spend limit. A single power user who generates 100x the average LLM traffic is an economics problem. Helicone can limit spend per user with &lt;code&gt;Helicone-RateLimit-Policy&lt;/code&gt; using &lt;code&gt;u=cents&lt;/code&gt; and &lt;code&gt;s=user&lt;/code&gt;, and LiteLLM can give each customer a &lt;code&gt;max_budget&lt;/code&gt;. Or check the per-user total from your own logs before each call.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pre-call cost estimation
&lt;/h3&gt;

&lt;p&gt;Before making a model call, estimate the expected cost from the input token count and the model. If the estimate exceeds a threshold, reject the request, use a cheaper model, or ask for explicit confirmation.&lt;/p&gt;




&lt;h2&gt;
  
  
  From Tracking to Cost Management
&lt;/h2&gt;

&lt;p&gt;LLM cost management is the loop that turns tracking data into lower or more predictable bills. It has four steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Track.&lt;/strong&gt; Log every call with its cost, feature, user and model, using the cost function above or a tool from the table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alert.&lt;/strong&gt; Set a provider spend alert at 80% of the monthly budget, and a spike alert on your own data for cost per hour and cost per call by feature.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cap.&lt;/strong&gt; Put hard limits at the provider for each project or workspace, and per-user or per-feature budgets in your code or gateway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review.&lt;/strong&gt; Once a week, sort features and users by spend and look at the top three of each. For each one, decide whether the prompt can be shorter, whether caching would help, whether a cheaper model holds up on that task (test it on your own traffic first), or whether the plan price needs to change.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://www.promptunit.ai/blog/llm-observability-metrics-guide" rel="noopener noreferrer"&gt;LLM Observability: The Metrics That Actually Drive Decisions&lt;/a&gt; covers the other metrics worth watching next to cost.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where PromptUnit Fits
&lt;/h2&gt;

&lt;p&gt;PromptUnit checks each request, and when a cheaper model is just as good for that request, it uses that model; otherwise the request goes to the model you asked for. Setup is two settings: point your app's AI API base URL at it and add your PromptUnit key. Your own provider key stays. For cost tracking, the dashboard shows the cost of every request and breaks cost down per model, and per feature when you tag requests with the optional &lt;code&gt;x-promptunit-feature&lt;/code&gt; header (letters, digits, underscore, hyphen and dot, up to 64 characters). It also groups requests into the steps of your app or agent and shows what each step costs.&lt;/p&gt;

&lt;p&gt;PromptUnit has no per-user view, so keep per-user cost in your own logs with the queries above. In Privacy mode only what billing needs is stored (the models, tokens, cost and response time), so feature names and steps are not kept.&lt;/p&gt;




&lt;h2&gt;
  
  
  See Also
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/openai-api-too-expensive-what-to-do" rel="noopener noreferrer"&gt;OpenAI API Cost Too High? Six Fixes, Ordered by Effort&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/hidden-cost-of-defaulting-to-gpt4" rel="noopener noreferrer"&gt;The Hidden Cost of Defaulting to Your Flagship Model&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/llm-cost-attribution-by-feature" rel="noopener noreferrer"&gt;LLM Cost Attribution by Feature&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/ai-cost-per-user-saas-unit-economics" rel="noopener noreferrer"&gt;AI Cost Per User&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/promptunit-vs-helicone" rel="noopener noreferrer"&gt;PromptUnit vs Helicone&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.promptunit.ai/blog/promptunit-vs-langfuse" rel="noopener noreferrer"&gt;PromptUnit vs Langfuse&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Try It Free
&lt;/h2&gt;

&lt;p&gt;See where your AI budget goes. PromptUnit's dashboard shows every request with the model that answered and what it cost. It is free until it has saved you money, then it takes 20% of what it saves.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.promptunit.ai/sign-up" rel="noopener noreferrer"&gt;Start free&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is LLM cost tracking?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Recording what each model call costs, together with the feature, user, model and environment behind it. The provider invoice gives you one total. Tracking per request shows which feature or user drives the spend and whether cost grows faster than usage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between LLM cost tracking and LLM cost management?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tracking tells you where the money went. Cost management is what you do with that data: alerts before the budget runs out, hard caps at the provider or in a gateway, and a regular review of the top features and users by spend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I track LLM cost per user?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Send your internal user id with every call, compute each call's cost from the usage object the provider returns, and store both. Then group by user and day in SQL and compare each user's 30-day cost with the price of their plan. Gateways such as Helicone and LiteLLM can group by a user id header for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I set a hard spending limit on OpenAI, Anthropic or Google?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes, but not per API key. OpenAI sets monthly hard limits per organization or per project, Anthropic sets monthly spend limits per workspace, and Google lets you set a monthly spend cap per project in AI Studio, a feature it marks as experimental. Checked October 16, 2026.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How much more do output tokens cost than input tokens?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For prompts up to 272K tokens, five times on OpenAI's GPT-6 models and six times on GPT-5.6 Terra and GPT-5.4. Five times on Anthropic's current Claude models. On Google it runs from five times (Gemini 3.8 Flash) to about eight times (Gemini 3.5 Flash-Lite). Checked November 5, 2026.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>llmcosttracking</category>
    </item>
    <item>
      <title>AI Cost Optimization Checklist 2026: 15 Steps to Lower Your API Bill</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Tue, 03 Nov 2026 14:00:38 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/ai-cost-optimization-checklist-2026-15-steps-to-lower-your-api-bill-3og0</link>
      <guid>https://dev.to/scorpion4ik26lang/ai-cost-optimization-checklist-2026-15-steps-to-lower-your-api-bill-3og0</guid>
      <description>&lt;p&gt;&lt;em&gt;I am the founder of PromptUnit. This post first appeared on the &lt;a href="https://www.promptunit.ai/blog/ai-cost-optimization-checklist-2026" rel="noopener noreferrer"&gt;PromptUnit blog&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A 40-70% lower AI bill is our estimate for a workload with many simple requests. It is not a guarantee, and it does not come from a single clever optimization. It comes from working through a list. Model selection, caching, prompt compression, routing, batching, context pruning. None of these techniques is complicated individually. The savings compound when you apply them in combination, and most teams have only done two or three of them.&lt;/p&gt;

&lt;p&gt;This is a 15-point checklist written for engineering and platform teams managing production LLM workloads. The items are ordered roughly by typical savings impact, with the highest-leverage actions first. Each item includes an estimated savings range, though your actual results will depend on your current setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Audit Which Model You Are Defaulting To
&lt;/h2&gt;

&lt;p&gt;Before anything else, find out what model your application is actually calling in production. Teams regularly discover they are running on a flagship model because it was the default in a tutorial or set during prototyping and never revisited. If you are running GPT-5.4 at $2.50 per million input tokens and $15 per million output tokens on tasks a smaller model handles equally well, a model change alone cuts the cost of those calls by 70% on GPT-5.4 mini ($0.75 and $4.50) or about 92% on GPT-5.4 nano ($0.20 and $1.25), at OpenAI's list prices as of October 2026. Check your API usage dashboard, match model names to current pricing, and establish your baseline before moving on. &lt;a href="https://www.promptunit.ai/blog/hidden-cost-of-defaulting-to-gpt4" rel="noopener noreferrer"&gt;The hidden cost of defaulting to your flagship model&lt;/a&gt; shows what each month of leaving it costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. A/B Test Cheaper Models on Your Actual Production Tasks
&lt;/h2&gt;

&lt;p&gt;Do not assume the quality gap between models is meaningful for your use case. The only reliable test is running both models on a representative sample of your real production inputs and scoring the outputs using a rubric that matches your actual quality requirements. Take 100 examples from your production logs. Run both the current model and a cheaper candidate. Score them. If the cheaper model performs within 5% of the current model on your rubric, you have a clear routing decision. The measurement takes a day to set up. Skipping it means either missing savings or discovering quality regressions through user complaints. &lt;a href="https://www.promptunit.ai/blog/gpt-4o-mini-real-world-quality-analysis" rel="noopener noreferrer"&gt;We estimate GPT-4o-mini handles 60-70% of typical production tasks&lt;/a&gt; about as well as GPT-4o. That is a rough estimate, not a measurement, and the question is whether your specific tasks are in that majority.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Enable Provider-Side Prompt Caching
&lt;/h2&gt;

&lt;p&gt;Anthropic offers 90% off cached token reads when prompt caching is enabled on requests with repeated system prompts or context. OpenAI automatically caches the prefix of prompts over a certain length, providing 90% or more off for cached input tokens on current models (95% on GPT-6.1 Sol). For applications with large, static system prompts, the savings on input costs are significant. A system prompt of 2,000 tokens sent 100,000 times per day costs $600 per day in input tokens at Claude Sonnet 4.6 pricing without caching. With caching, after the first call, those reads cost $60 per day. Estimated savings: 20-60% on input costs for any application with repeated system prompt content. The implementation requires a small change to how you structure requests, and the savings begin immediately.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Tag API Calls by Feature
&lt;/h2&gt;

&lt;p&gt;This item does not directly reduce costs, but it enables every other optimization on this list. Without per-feature attribution, you cannot know which tasks to target, which optimizations have the highest impact, or whether your changes are working. Tag every API call with at minimum the feature name and user tier. Store these alongside the token counts from API responses. Build a weekly report sorted by total spend per feature. The first time you run this report, you will almost certainly find that one or two features account for the majority of your AI spend, and at least one of them will be a candidate for immediate optimization. The &lt;a href="https://www.promptunit.ai/blog/llm-cost-attribution-by-feature" rel="noopener noreferrer"&gt;complete guide to LLM cost attribution by feature&lt;/a&gt; covers implementation approaches in detail.&lt;/p&gt;

&lt;p&gt;Catching a new expensive model call before it merges is cheaper than catching it on next month's invoice. &lt;a href="https://www.promptunit.ai/blog/ai-cost-check-every-pr-github-action" rel="noopener noreferrer"&gt;The PromptUnit GitHub Action scans every pull request diff&lt;/a&gt; for newly added GPT-4o, Claude Opus, or Gemini 2.5 Pro calls and posts a routing savings estimate as a PR comment, so the cost conversation happens at code review time instead of at audit time.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Compress System Prompts
&lt;/h2&gt;

&lt;p&gt;System prompts grow over time. Developers add instructions to handle edge cases, include examples to improve output quality, and paste in context that seemed useful during testing. Few people go back to remove content that is no longer needed. Audit your system prompts for redundancy, filler phrases, and instructions that are not actually changing model behavior. A disciplined compression pass typically achieves 30-50% token reduction on system prompts without any quality change. At high call volumes, the savings from prompt compression alone can be substantial. A 1,000-token system prompt compressed to 600 tokens saves 400 tokens on every call, and those savings multiply directly against your call volume and input token rate.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Add Output Length Constraints to Prompts
&lt;/h2&gt;

&lt;p&gt;Output tokens cost more than input tokens on every major provider. Claude Sonnet 4.6 charges $3 per million input tokens and $15 per million output tokens. Unconstrained output length means you are paying for however many tokens the model decides to generate, which is often more than you need. Adding explicit length guidance to prompts, such as "respond in under 100 words" or "return a JSON object with exactly these fields," reduces output length without reducing output quality for most structured tasks. Estimated savings: 20-40% on output costs for tasks with unconstrained generation where the output length is not inherently variable.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Implement Application-Level Caching for Repeated Identical Queries
&lt;/h2&gt;

&lt;p&gt;If users in your application ask the same questions, and they do, those are opportunities for full response caching at the application layer. A Redis or Memcached store keyed by the hash of the user query and system prompt context can return instant, free responses for repeat queries without any API call. Savings are up to 100% of cost for cached queries. For products with shared corpora, high user overlap, or predictable query patterns, cache hit rates of 20-50% are realistic. The engineering investment is low. The savings begin immediately on deployment.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Move Batch Workloads to the Batch API
&lt;/h2&gt;

&lt;p&gt;OpenAI and Anthropic both offer 50% off standard token rates for requests submitted through their Batch APIs. The tradeoff is latency. Batch API requests are processed asynchronously, typically within a few hours rather than in real time. For any workload that is not user-facing and does not require immediate responses, this is a straightforward 50% cost reduction. Document processing, embedding generation, content classification, offline analysis, and evaluation runs are all strong candidates. If you are currently running these synchronously because nobody set up the batch pipeline, the setup cost is a few hours of engineering work. The ongoing savings are immediate. See the full &lt;a href="https://www.promptunit.ai/blog/batch-api-50-percent-routing-decision" rel="noopener noreferrer"&gt;batch API decision framework&lt;/a&gt; for a routing guide.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Implement Cross-Provider Model Routing
&lt;/h2&gt;

&lt;p&gt;Different providers offer different price-performance points for different task types. Claude Haiku 4.5 at $1 per million input tokens and $5 per million output tokens handles many classification and extraction tasks at lower cost than some OpenAI alternatives. Gemini 3 Flash Preview at $0.50 per million input tokens and $3.00 per million output tokens is competitive for high-volume simple tasks. Routing simple tasks to the cheapest capable model while reserving more capable models for complex requests can lower the cost of those requests sharply: in our own 24 comparisons the cheaper models cost about 89% less per call, and across a whole bill we estimate 40-70% for a workload with many simple requests (an estimate, not a guarantee; see &lt;a href="https://www.promptunit.ai/blog/gpt4-calls-analysis-model-routing" rel="noopener noreferrer"&gt;what we measured&lt;/a&gt;). PromptUnit provides routing infrastructure for cross-provider dispatch so teams can implement this without custom routing code. The &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;cross-provider routing guide&lt;/a&gt; covers the provider comparison in depth.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Prune Conversation Context
&lt;/h2&gt;

&lt;p&gt;Multi-turn applications that send the full conversation history on every API call are paying for context that is often irrelevant to the current user request. A conversation that has been going for ten turns before reaching the current question includes early context, clarifications, and prior outputs that may have no bearing on the next response. Summarize older turns rather than sending them verbatim. Limit context to the most recent N turns plus the original task context. For most conversation types, the most recent 3-5 turns plus the system context is sufficient. Estimated savings: 30-60% on input costs for multi-turn applications. This is one of the highest-impact optimizations for chat-based products.&lt;/p&gt;

&lt;h2&gt;
  
  
  11. Reduce Few-Shot Examples
&lt;/h2&gt;

&lt;p&gt;System prompts that include multiple few-shot examples are often carrying more examples than necessary. The marginal quality improvement from a fifth example over a second example is typically small, while the token cost is linear. Test 2-shot versus 5-shot on your task. Run the comparison on 50-100 examples and measure output quality. For most classification and extraction tasks, 2-shot achieves 90% or more of the quality improvement available from 5-shot, at 60% lower cost for the example portion of the prompt. The exact savings depend on the length of your examples, but for prompts where examples represent 30-50% of total input tokens, this test is worth running.&lt;/p&gt;

&lt;h2&gt;
  
  
  12. Use Structured Output Modes
&lt;/h2&gt;

&lt;p&gt;For structured extraction or transformation tasks, JSON mode produces denser outputs than conversational responses. A preamble like "Sure! Here is the information you requested in JSON format: {..." wastes tokens. A clean JSON object with no framing is more useful and cheaper. Structured output modes also reduce malformed response rates, meaning fewer retries and lower total cost per successful call. Estimated savings: 20-40% on output tokens for extraction and transformation tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  13. Set Per-Feature and Per-User Cost Budgets in Code
&lt;/h2&gt;

&lt;p&gt;Implement cost guardrails in your application that stop or throttle API calls when a user or feature exceeds a defined spend threshold within a billing period. This prevents cost anomalies from compounding undetected. A bug that causes a loop to generate thousands of API calls, a user who constructs adversarial prompts that produce long outputs, or a spike in traffic that triggers unexpectedly high consumption, all of these can be caught early if you have budget limits in code rather than discovering them in the next billing statement. This is not primarily an optimization. It is cost governance, and it prevents the kind of five-figure surprise bills that have hurt real companies.&lt;/p&gt;

&lt;h2&gt;
  
  
  14. Monitor Your Retry Rate
&lt;/h2&gt;

&lt;p&gt;High retry rates silently multiply your API costs. If your application retries on rate limit errors, timeout errors, or output validation failures, each retry is an additional API call. A 20% retry rate effectively increases your cost per successful call by 20%, before accounting for the output tokens spent on failed calls that still counted toward your bill. Pull your retry rate from application logs. If it is above 5%, investigate the root cause rather than absorbing the cost. Common causes include prompts that reliably produce outputs failing your validation schema, rate limit misconfiguration, and inconsistent output length causing timeout errors. Fixing the root cause saves costs and improves latency simultaneously.&lt;/p&gt;

&lt;h2&gt;
  
  
  15. Re-Evaluate Model Choices Quarterly
&lt;/h2&gt;

&lt;p&gt;Model pricing and capabilities change fast. A routing decision that was optimal three months ago may not be optimal today. In 2026, multiple providers have released new model tiers with meaningfully lower pricing at comparable quality levels. A quarterly review of your routing configuration against current model offerings is low effort and can identify opportunities that did not exist when your configuration was last set. Run a quick A/B test on any new model that looks competitive. For a current view of model pricing across providers, see the &lt;a href="https://www.promptunit.ai/blog/openai-api-too-expensive-what-to-do" rel="noopener noreferrer"&gt;OpenAI API cost calculator and pricing guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Compounding Effect
&lt;/h2&gt;

&lt;p&gt;These fifteen techniques are additive. A team that applies model selection, prompt caching, system prompt compression, and batch routing to eligible workloads sees the product of several independent multipliers applied to their baseline cost. A 30% reduction from model selection combined with a 40% reduction from caching combined with 50% off batch workloads produces a combined reduction substantially larger than any single item.&lt;/p&gt;

&lt;p&gt;Working through a list like this one and compounding the savings is how a bill comes down by more than any single item allows. Our estimate is 40-70% for a workload with many simple requests, not a guarantee. Most of the work is measurement and configuration, not fundamental engineering changes.&lt;/p&gt;

&lt;p&gt;PromptUnit automates the model-choice items on this list at the proxy, with no application code changes: it checks each request and, when a cheaper model is just as good for it, uses that model, including one at another provider whose key you connected. The other items are changes to your own prompts and code.&lt;/p&gt;

&lt;p&gt;Start reducing your AI API costs systematically at &lt;a href="https://www.promptunit.ai" rel="noopener noreferrer"&gt;www.promptunit.ai&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>costoptimization</category>
    </item>
    <item>
      <title>LLM Routing: How It Works, Strategies and Real Data</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Fri, 30 Oct 2026 14:00:38 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/llm-routing-how-it-works-strategies-and-real-data-353i</link>
      <guid>https://dev.to/scorpion4ik26lang/llm-routing-how-it-works-strategies-and-real-data-353i</guid>
      <description>&lt;p&gt;Liquid syntax error: Unknown tag 'endraw'&lt;/p&gt;
</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>llmrouting</category>
    </item>
    <item>
      <title>Gemini 2.5 Pro vs Flash Cost (and the Newer Gemini Models)</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Tue, 27 Oct 2026 14:00:38 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/gemini-25-pro-vs-flash-cost-and-the-newer-gemini-models-405</link>
      <guid>https://dev.to/scorpion4ik26lang/gemini-25-pro-vs-flash-cost-and-the-newer-gemini-models-405</guid>
      <description>&lt;p&gt;&lt;em&gt;I am the founder of PromptUnit. This post first appeared on the &lt;a href="https://www.promptunit.ai/blog/gemini-2-5-pro-vs-flash-cost-guide" rel="noopener noreferrer"&gt;PromptUnit blog&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Gemini 2.5 Flash costs about a quarter of what Gemini 2.5 Pro costs per token at standard prompt lengths, and as little as an eighth on prompts over 200,000 tokens. That gap makes the routing question simple on the surface, but the real question is not "which is cheaper?" It is "which tasks actually need Pro, and what does it cost to get that wrong?"&lt;/p&gt;

&lt;p&gt;All prices below are Google's paid-tier list prices per million tokens, from the &lt;a href="https://ai.google.dev/gemini-api/docs/pricing" rel="noopener noreferrer"&gt;Gemini API pricing page&lt;/a&gt;, checked October 15, 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pricing structure in detail
&lt;/h2&gt;

&lt;p&gt;Gemini 2.5 Pro has two price tiers based on prompt length: one for prompts up to 200,000 tokens and a higher one above that. Gemini 2.5 Flash has a single price for text, image and video input at any length, with a separate price for audio input.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input, prompts up to 200k&lt;/th&gt;
&lt;th&gt;Input, prompts over 200k&lt;/th&gt;
&lt;th&gt;Output, up to 200k&lt;/th&gt;
&lt;th&gt;Output, over 200k&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 2.5 Pro&lt;/td&gt;
&lt;td&gt;$1.25&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;$15.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 2.5 Flash&lt;/td&gt;
&lt;td&gt;$0.30 (audio $1.00)&lt;/td&gt;
&lt;td&gt;$0.30 (audio $1.00)&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;At standard lengths Pro costs about 4.2 times Flash on input ($1.25 against $0.30) and exactly 4 times on output ($10.00 against $2.50). On prompts over 200,000 tokens the gap widens to about 8.3 times on input and 6 times on output, because Flash has no long-prompt surcharge. Both output prices include thinking tokens, so an answer that reasons at length costs more than its visible text suggests.&lt;/p&gt;

&lt;p&gt;Here is what that means on a long call. A 250,000-token document costs $0.625 to send to Pro (250,000 tokens at $2.50 per million) and $0.075 to send to Flash. A 5,000-token answer adds $0.075 on Pro and $0.0125 on Flash. Ten thousand such calls a month come to $6,250 in input alone on Pro, against $750 on Flash.&lt;/p&gt;

&lt;p&gt;Context caching is available for both. Cached Pro input costs $0.125 per million tokens for prompts up to 200,000 tokens and $0.25 above that, plus $4.50 per million tokens per hour of storage. Cached Flash input costs $0.03 per million tokens for text, image and video ($0.10 for audio), plus $1.00 per million tokens per hour of storage. If you work with large documents that several calls in a session refer to, caching cuts Pro's effective cost substantially.&lt;/p&gt;

&lt;p&gt;Both models also have a Batch price at half the standard input and output rates, for work that can wait.&lt;/p&gt;

&lt;p&gt;To compare these with other providers, see the current GPT prices in our &lt;a href="https://www.promptunit.ai/blog/azure-openai-vs-openai-direct-cost-comparison" rel="noopener noreferrer"&gt;Azure OpenAI vs OpenAI direct table&lt;/a&gt; and Anthropic's in the &lt;a href="https://www.promptunit.ai/blog/anthropic-claude-api-pricing-guide-2026" rel="noopener noreferrer"&gt;Claude API pricing guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Flash is the right call
&lt;/h2&gt;

&lt;p&gt;Flash performs well on a wide range of tasks that do not require deep multi-step reasoning. Classification is the clearest case: routing customer queries to the right department, labeling sentiment, tagging content categories. These tasks are largely pattern matching against a fixed taxonomy, and Flash handles them accurately and fast.&lt;/p&gt;

&lt;p&gt;Extraction tasks, pulling structured data from documents, are another strong Flash use case. The model needs to find specific fields in text and return them in a structured format. It does not need to reason through ambiguity or connect long chains of logic. Most production extraction pipelines can use Flash and meet their quality bar.&lt;/p&gt;

&lt;p&gt;Standard-length document summarization, Q&amp;amp;A over clear and well-structured source text, customer support routing and intent classification all fall into this group. These tasks have well-defined inputs and outputs, and the main failure mode is missing an explicit piece of information rather than failing to reason through something complex. Flash's lower ceiling rarely matters for these workloads.&lt;/p&gt;

&lt;p&gt;For a detailed look at how to segment workloads by complexity and route accordingly, see the &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;LLM model routing guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Pro is worth the premium
&lt;/h2&gt;

&lt;p&gt;The case for Pro rests on two arguments: stronger reasoning and the cost of quality errors.&lt;/p&gt;

&lt;p&gt;Gemini 2.5 Pro is the stronger model on problems that need multi-step reasoning: debugging complex logic, writing non-trivial algorithms and understanding large codebases. If your application generates code where errors have downstream costs, such as code that goes into production or runs in an automated pipeline, the extra $0.95 per million input tokens and $7.50 per million output tokens may be the cheapest quality insurance available.&lt;/p&gt;

&lt;p&gt;Complex multi-step reasoning is the other clear Pro case. Legal document analysis where the model has to track several clauses and how they interact, medical record summarization where accuracy matters clinically, financial report analysis where misreading a number has consequences. In these contexts the cost of a wrong answer usually far exceeds the price difference between the models.&lt;/p&gt;

&lt;p&gt;The general principle: when a model error is cheap, use Flash. When a model error is expensive, work out whether Pro's lower error rate pays for itself at your volume. Take 1,000 medical document analyses a month at about 10,000 input tokens and 1,000 output tokens each. On Pro that is $12.50 for input and $10.00 for output, $22.50 a month. On Flash it is $3.00 plus $2.50, $5.50 a month. If Pro avoids even a handful of errors that each cost a person time to catch and correct, the $17 a month difference pays for itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  The long-context case
&lt;/h2&gt;

&lt;p&gt;Both models accept very long prompts, an area where Google is ahead of many competitors. Long prompts have a cost beyond the price tier, though.&lt;/p&gt;

&lt;p&gt;A 500,000-token prompt costs $1.25 in input alone on Pro (500,000 tokens at $2.50 per million) and $0.15 on Flash. If you send entire codebases, long contracts or large research documents in every prompt, model choice matters even more at this size, and Pro's long-prompt tier doubles its input price.&lt;/p&gt;

&lt;p&gt;There is also a quieter point: for many long-context tasks you do not need to send the whole document every time. Retrieval that pulls the relevant 5,000 to 10,000-token chunks can shrink your prompts dramatically and keep Pro under the 200,000-token threshold. The &lt;a href="https://www.promptunit.ai/blog/rag-pipeline-hidden-costs" rel="noopener noreferrer"&gt;RAG pipeline hidden costs post&lt;/a&gt; covers the tradeoffs between full-context and retrieval-based approaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical routing rule for production systems
&lt;/h2&gt;

&lt;p&gt;The most cost-effective pattern for Gemini is usually not to pick one model and stay with it. It is to default to Flash and escalate to Pro when a quality check fails.&lt;/p&gt;

&lt;p&gt;In practice: start every request on Flash. After the response arrives, run a lightweight quality check, a simple heuristic, a small classifier or a confidence score where the task allows it. If the check fails, run the request again on Pro. If it passes, return the Flash answer.&lt;/p&gt;

&lt;p&gt;As an illustration, suppose 80% of calls pass on Flash and 20% escalate, and a Pro call costs about 4 times a Flash call. The cost becomes 0.8 times the Flash cost plus 0.2 times (the Flash cost plus the Pro cost), which is 1.8 times the Flash cost. Running everything on Pro would cost 4 times the Flash cost, so the cascade costs 45% of all-Pro, or 55% less, while still giving Pro's answer to the calls that need it. Your own pass rate decides the real number.&lt;/p&gt;

&lt;p&gt;The key engineering requirement is a quality check in production. Without one, you cannot cascade sensibly. The routing guide linked above covers implementation patterns.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the newer Gemini models fit
&lt;/h2&gt;

&lt;p&gt;Google still serves Gemini 2.5 Pro and 2.5 Flash, and its &lt;a href="https://ai.google.dev/gemini-api/docs/deprecations" rel="noopener noreferrer"&gt;deprecations page&lt;/a&gt; lists no shutdown date for either. But Google now limits access to the 2.5 models to users who have actively used them in the past, and points new projects to Gemini 3.5 Flash-Lite or 3.8 Flash. The newer models, per million tokens, from Google's &lt;a href="https://ai.google.dev/gemini-api/docs/pricing" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gemini 3.5 Flash-Lite: $0.30 input, $2.50 output&lt;/li&gt;
&lt;li&gt;Gemini 3.6 and 3.8 Flash: $0.75 input, $3.75 output through December 31, 2026, then $1.50 and $7.50 from January 1, 2027. Gemini 3.5 Flash and 3.7 Flash were deprecated on October 8, 2026, and requests to them are answered by 3.6 Flash and 3.8 Flash.&lt;/li&gt;
&lt;li&gt;Gemini 3.1 Pro Preview: $2.00 input and $12.00 output for prompts up to 200k tokens, $4.00 and $18.00 above&lt;/li&gt;
&lt;li&gt;Gemini 4 Argon, released October 13, 2026: $2 input and $10 output through November 30, 2026, then $4 and $20 (&lt;a href="https://www.promptunit.ai/blog/gemini-4-argon-api-pricing-december-increase" rel="noopener noreferrer"&gt;full breakdown&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Gemini 3.1 Flash-Lite: $0.25 input, $1.50 output, but it is deprecated and shuts down on May 7, 2027 (its replacement is 3.5 Flash-Lite)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Price alone does not tell you which to use. 3.5 Flash-Lite costs the same as 2.5 Flash, and the 3.6 and 3.8 Flash models cost more today and double in price at the start of 2027. If your account still has 2.5 Flash and a task passes your quality bar on it, test 3.5 Flash-Lite on your own requests before you have to move, and re-check your numbers when the January price change lands.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tracking the cost difference in production
&lt;/h2&gt;

&lt;p&gt;PromptUnit shows every request with the model you asked for, the model that answered, what it cost and what it saved, so you can see what each part of your app really spends on Gemini. It works with your own Google key. It moves a request to a cheaper model only when it expects the answer to be just as good, and otherwise keeps the model you asked for.&lt;/p&gt;

&lt;p&gt;If your Gemini costs have grown faster than you expected, &lt;a href="https://www.promptunit.ai/sign-up" rel="noopener noreferrer"&gt;start free&lt;/a&gt;: the first $5 of savings is free.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How much cheaper is Gemini 2.5 Flash than Gemini 2.5 Pro?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;About four times per token at standard lengths: Flash costs $0.30 per million input tokens and $2.50 per million output tokens, Pro $1.25 and $10.00 for prompts up to 200,000 tokens (Google's pricing page, October 2026). Above 200,000 tokens Pro rises to $2.50 and $15.00 while Flash stays the same, so the input gap grows to about eight times.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can new projects still use Gemini 2.5 Pro and 2.5 Flash?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Google still serves both and lists no shutdown date, but it now limits access to the 2.5 models to users who have actively used them before, and points new projects to Gemini 3.5 Flash-Lite or Gemini 3.8 Flash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which newer Gemini model costs the same as Gemini 2.5 Flash?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Gemini 3.5 Flash-Lite: $0.30 per million input tokens and $2.50 per million output tokens, the same as 2.5 Flash, with a 1M-token context window. Gemini 3.8 Flash costs $0.75 and $3.75 through December 31, 2026, then $1.50 and $7.50.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When is Gemini 2.5 Pro worth the extra cost?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When a wrong answer is expensive: multi-step reasoning, debugging complex logic or writing non-trivial code, where Pro's lower error rate can pay for its price. When a mistake is cheap and easy to catch, Flash usually wins. Test both on a sample of your own requests before you decide.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>geminipricing</category>
    </item>
    <item>
      <title>Claude on AWS Bedrock vs Anthropic API: Cost Compared</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Fri, 23 Oct 2026 14:00:38 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/claude-on-aws-bedrock-vs-anthropic-api-cost-compared-2ln0</link>
      <guid>https://dev.to/scorpion4ik26lang/claude-on-aws-bedrock-vs-anthropic-api-cost-compared-2ln0</guid>
      <description>&lt;p&gt;&lt;em&gt;I am the founder of PromptUnit. This post first appeared on the &lt;a href="https://www.promptunit.ai/blog/claude-aws-bedrock-vs-anthropic-api-cost" rel="noopener noreferrer"&gt;PromptUnit blog&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The short answer: Claude costs the same per token on AWS Bedrock and on the Anthropic API, at global endpoint rates. The two platforms list identical input and output prices for every current Claude model. Costs diverge in specific situations: if you need regional data residency, Bedrock charges a 10% premium for region-locked routing (Anthropic's own API charges the same 10% for US-only inference). Beyond price, the platforms differ in feature availability, model freshness, and what you can build on top, and those differences affect total cost more than the per-token rate does.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Baseline: Token Prices Are at Parity
&lt;/h2&gt;

&lt;p&gt;Anthropic's pricing documentation is explicit that AWS Bedrock and Google Cloud use the same per-token rates as the direct Claude API for global endpoint traffic. Every figure in the table below reflects that: identical numbers on both platforms, on-demand, at standard global routing.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input (per 1M tokens)&lt;/th&gt;
&lt;th&gt;Output (per 1M tokens)&lt;/th&gt;
&lt;th&gt;Cache read (per 1M tokens)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 5.5 (≤100K tokens)&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;td&gt;$0.01&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 5&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;$0.20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 5.5&lt;/td&gt;
&lt;td&gt;$4.00&lt;/td&gt;
&lt;td&gt;$20.00&lt;/td&gt;
&lt;td&gt;$0.20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 5 / Opus 4.8&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;td&gt;$25.00&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Fable 5.1&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;$50.00&lt;/td&gt;
&lt;td&gt;$0.25&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Prices per million tokens, on-demand, global endpoints. Source: Anthropic pricing documentation, October 2026.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Claude Sonnet 5's $2/$10 rate, which launched as introductory pricing with a scheduled increase to $3/$15 on September 1, 2026, had that increase cancelled. That permanent $2/$10 price applies on both platforms.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the Price Actually Diverges
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Regional routing adds 10% on both sides
&lt;/h3&gt;

&lt;p&gt;Starting with Claude Haiku 4.5, Sonnet 4.5, and Opus 4.5, Anthropic's pricing documentation specifies that Bedrock regional and multi-region endpoints carry a 10% premium over global endpoints. The global endpoint routes dynamically across available regions; a regional endpoint guarantees that inference stays within a specific geography for data residency. If you need data to stay in EU-West or US-East, you pay 10% more.&lt;/p&gt;

&lt;p&gt;The same logic applies to the Anthropic direct API. Using the &lt;code&gt;inference_geo: "us"&lt;/code&gt; parameter on Claude 4.6 and later models applies a 1.1x multiplier across all token categories, including input, output, cache writes, and cache reads. Neither platform is cheaper when you constrain geography: they both add 10% for data residency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Batch processing: identical 50% discount
&lt;/h3&gt;

&lt;p&gt;Both the Anthropic API and Bedrock offer a Batch API at 50% off on-demand rates. Sonnet 5 drops from $2/$10 to $1/$5 per million tokens in batch mode on both platforms. There is one important caveat on Bedrock: the Batch API is available only through the legacy InvokeModel integration for older models (Opus 4.6 and earlier). For newer models accessed via Bedrock's Messages API integration (Opus 4.7 and later), the Batch API is not currently available on Bedrock. If your workload runs on current-generation Claude models and you want batch pricing, the Anthropic direct API gives you access that Bedrock does not.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prompt caching: same rates, same math
&lt;/h3&gt;

&lt;p&gt;Prompt caching rates match across platforms. A 5-minute cache write costs 1.25x the base input price; a 1-hour write costs 2x; a cache read costs 0.1x (dropping to 0.05x on Claude Opus 5.5 and Sonnet 5.5, and 0.025x on Claude Fable 5.1). The &lt;a href="https://www.promptunit.ai/blog/prompt-caching-cost-savings-openai-anthropic" rel="noopener noreferrer"&gt;prompt caching savings math&lt;/a&gt; is identical regardless of which platform you use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Feature Differences That Drive Real Cost
&lt;/h2&gt;

&lt;p&gt;Beyond token prices, the platforms differ in what they let you do, and those gaps affect your architecture and therefore your total bill.&lt;/p&gt;

&lt;h3&gt;
  
  
  New models arrive on Anthropic's API first
&lt;/h3&gt;

&lt;p&gt;Anthropic releases new Claude models to its own API first. Bedrock availability follows, sometimes by weeks, sometimes by months depending on the AWS integration effort required. If a new model is meaningfully faster or cheaper than its predecessor, every week you spend waiting on Bedrock is a week you pay the old rate. Teams that depend on current-generation capabilities, or who want to benchmark new models immediately at launch, can only do that through the Anthropic direct API.&lt;/p&gt;

&lt;h3&gt;
  
  
  Server-side tools are not available on Bedrock
&lt;/h3&gt;

&lt;p&gt;The Anthropic API's built-in web search and code execution tools are not available through Amazon Bedrock's standard integration. This matters for cost because server-side tools can replace agent loop architectures that otherwise compound token usage. If your agent needs web search at every step, the &lt;a href="https://www.promptunit.ai/blog/multi-agent-llm-cost-spiral" rel="noopener noreferrer"&gt;multi-agent cost spiral&lt;/a&gt; of hand-rolling that capability with API calls can add up quickly, and Bedrock does not give you a shortcut.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rate limits are set independently
&lt;/h3&gt;

&lt;p&gt;Bedrock and Anthropic set their own rate limits, and the limits differ by model and tier. Anthropic's direct API uses usage tiers (Start, Build, Scale) with explicit requests-per-minute and tokens-per-minute limits, and these scale automatically as you build usage history. Bedrock has its own quota system, managed through the AWS console, with separate limits per region and inference profile. For teams already on AWS with committed spend, Bedrock reserved throughput is an option for high-volume steady workloads, though it requires contacting AWS for pricing. Neither platform is obviously better here: it depends on your volume, region, and whether you already have AWS enterprise agreements that affect capacity.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Third Option: Claude Platform on AWS
&lt;/h2&gt;

&lt;p&gt;There is a middle path worth knowing about: Claude Platform on AWS, which launched in general availability in May 2026. Anthropic operates the stack, not AWS. It uses the standard Anthropic Messages API, gets new models on the same day as the direct API, and includes the same server-side tools and beta features. Billing runs through AWS Marketplace using Claude Consumption Units (CCUs), where 100 CCUs equals $1.00 at standard Anthropic per-model rates. If your team needs AWS-native billing and IAM authentication but also needs the latest features on day one, Claude Platform on AWS is worth evaluating separately from standard Bedrock.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Practical Decision
&lt;/h2&gt;

&lt;p&gt;For most teams running current-generation Claude models, the token-level cost comparison is a wash at global rates. The decision comes down to three non-price factors:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use the Anthropic direct API if you:&lt;/strong&gt; want the Batch API on current models (Opus 4.7 and later), need new models immediately on launch, use or plan to use server-side tools like web search, or prefer simpler billing without AWS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use AWS Bedrock if you:&lt;/strong&gt; already have AWS infrastructure and want data within AWS boundaries, need IAM-based authentication or AWS CloudTrail for audit, or want to combine Claude with AWS-native services like Bedrock Guardrails and Bedrock Knowledge Bases. Be aware that Bedrock's standard integration does not currently support the Batch API for newer Claude models, so if 50% batch discounts matter for your workload, plan accordingly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use both if failover matters.&lt;/strong&gt; Because the same Claude model sits on separate capacity pools, calling Anthropic direct as primary and Bedrock as failover keeps requests succeeding when one platform returns rate limit errors. A proxy or gateway layer handles the routing transparently. This is a common production pattern and worth considering if Claude is on the critical path of your application. The &lt;a href="https://www.promptunit.ai/blog/ai-api-failover-guide" rel="noopener noreferrer"&gt;failover guide for AI APIs&lt;/a&gt; covers the error codes and retry logic for exactly this setup.&lt;/p&gt;

&lt;p&gt;If you are trying to reduce the total Claude spend regardless of platform, the levers are the same on both sides: prompt caching, batch for async work, model tiering by task complexity, and output length control. The &lt;a href="https://www.promptunit.ai/blog/reduce-claude-api-costs-guide" rel="noopener noreferrer"&gt;Claude API cost reduction guide&lt;/a&gt; walks through those steps in detail, and every technique in it applies whether your requests go to Anthropic or Bedrock. A cost optimization proxy like &lt;a href="https://www.promptunit.ai" rel="noopener noreferrer"&gt;PromptUnit&lt;/a&gt; can also route calls to a cheaper model automatically when the task does not need the full capability of the model you asked for, connecting keys from multiple providers to widen the options.&lt;/p&gt;

&lt;p&gt;The platform choice affects your architecture, compliance posture, and feature access. The token price, at global rates, is not the thing that distinguishes them.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is Claude cheaper on AWS Bedrock or the Anthropic API?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At global endpoint rates, the price is identical on both platforms. Claude Sonnet 5 costs $2 per million input tokens and $10 per million output tokens on both AWS Bedrock and the Anthropic direct API. The cost diverges if you use regional endpoints (both add a 10% premium for data residency) or if you want the Batch API on current-generation models, which is only available through the Anthropic direct API for Claude Opus 4.7 and later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does AWS charge a markup on Claude tokens compared to Anthropic's own API?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No, not at the standard global endpoint rate. Anthropic's own pricing documentation confirms that Bedrock global endpoints match the direct API dollar for dollar. The only token-level premium on Bedrock is for regional endpoints, which cost 10% more to guarantee that inference stays within a specific geography, and that same 10% applies on the Anthropic API too when you use the inference_geo parameter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does AWS Bedrock support the Claude Batch API for 50% off?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Bedrock supports a 50% batch discount, but only for older Claude models accessed through the legacy InvokeModel integration. For newer models using the Bedrock Messages API integration (Claude Opus 4.7 and later), the Batch API is not currently available on Bedrock. If you want batch pricing on current-generation Claude models, the Anthropic direct API is the only option.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are all Claude models available on AWS Bedrock?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not simultaneously with Anthropic's own API. Anthropic releases new Claude models to its direct API first, and Bedrock availability follows later, sometimes by weeks or months. If your application needs the latest model the day it launches, the Anthropic direct API is the only reliable choice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Claude Platform on AWS and how does it differ from Bedrock?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Claude Platform on AWS is a separate offering where Anthropic operates the infrastructure, not AWS. It uses the standard Anthropic Messages API, gets new models on the same day as the direct API, and includes server-side tools like web search and code execution that are not available on standard Bedrock. Billing runs through AWS Marketplace using Claude Consumption Units, where 100 CCUs equals $1 at Anthropic's standard rates.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>claude</category>
    </item>
    <item>
      <title>OpenAI API Cost Too High? Six Fixes, Ordered by Effort</title>
      <dc:creator>scorpion4ik26-lang</dc:creator>
      <pubDate>Tue, 20 Oct 2026 14:00:38 +0000</pubDate>
      <link>https://dev.to/scorpion4ik26lang/openai-api-cost-too-high-six-fixes-ordered-by-effort-1i13</link>
      <guid>https://dev.to/scorpion4ik26lang/openai-api-cost-too-high-six-fixes-ordered-by-effort-1i13</guid>
      <description>&lt;p&gt;&lt;em&gt;I am the founder of PromptUnit. This post first appeared on the &lt;a href="https://www.promptunit.ai/blog/openai-api-too-expensive-what-to-do" rel="noopener noreferrer"&gt;PromptUnit blog&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If your OpenAI API cost feels too high, it usually is, and the fix is rarely "switch providers." OpenAI's current GPT-6 lineup alone spans a 100x price range: GPT-6 Astra costs $10.00 per million input tokens and $50.00 per million output tokens, while GPT-6 Luna costs $0.10 and $0.50. A team that sends every call to one strong model can often cut its bill sharply on the tasks where a cheaper model holds up. Moving a call from GPT-5.4 ($2.50/$15.00) to GPT-5.4 mini ($0.75/$4.50), for example, cuts that call's cost to 30% of what it was. The savings come from six approaches, none of which require rebuilding the product. They stack on top of each other, and the first two require almost no engineering work. Start there.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to reduce OpenAI API costs: a checklist
&lt;/h2&gt;

&lt;p&gt;The short version, in the order we would do it. Prices here and below are OpenAI's standard rates per million tokens (input/output) for prompts up to 272K input tokens, checked on &lt;a href="https://developers.openai.com/api/docs/pricing" rel="noopener noreferrer"&gt;OpenAI's pricing page&lt;/a&gt; on October 16, 2026.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Measure what each request costs.&lt;/strong&gt; Log input, cached, output and reasoning tokens for every call, grouped by feature. There is a short code sample further down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use the cheapest model that passes your test.&lt;/strong&gt; &lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-luna" rel="noopener noreferrer"&gt;GPT-6 Luna&lt;/a&gt; ($0.10/$0.50) costs a twentieth of &lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-1-sol" rel="noopener noreferrer"&gt;GPT-6.1 Sol&lt;/a&gt; ($2.00/$10.00) and a hundredth of &lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-astra" rel="noopener noreferrer"&gt;GPT-6 Astra&lt;/a&gt; ($10.00/$50.00). Test on a sample of real traffic before you switch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check you are not paying more for an older model.&lt;/strong&gt; &lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-5" rel="noopener noreferrer"&gt;GPT-5.5&lt;/a&gt; ($5.00/$30.00) and &lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-6-sol" rel="noopener noreferrer"&gt;GPT-5.6 Sol&lt;/a&gt; ($4.00/$20.00) cost more per token than GPT-6.1 Sol. &lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-sol" rel="noopener noreferrer"&gt;GPT-6 Sol&lt;/a&gt; has the same list price as GPT-6.1 Sol but twice the cached-input price.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set reasoning effort per task.&lt;/strong&gt; GPT-5.5, GPT-5.6, GPT-6 Sol, GPT-6.1 Sol and GPT-6 Luna default to &lt;code&gt;medium&lt;/code&gt;, and reasoning tokens are billed as output. Try &lt;code&gt;low&lt;/code&gt;, or &lt;code&gt;none&lt;/code&gt; where the model accepts it, on simple tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cap the output.&lt;/strong&gt; Ask for short answers or JSON only, and set &lt;code&gt;max_output_tokens&lt;/code&gt; with room left for reasoning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make prompt caching actually hit.&lt;/strong&gt; Put stable content first, keep tools and settings the same between calls, and on GPT-5.6 and later add an explicit cache breakpoint after the static part. Cached input costs 50% to 95% less than normal input, depending on the model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Send work that can wait to Flex or Batch.&lt;/strong&gt; Both cost half the standard rate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skip the surcharges you do not need.&lt;/strong&gt; Fast mode costs 2x on the GPT-6 models, prompts over 272K input tokens cost 2x input and 1.5x output on GPT-5.4, GPT-5.5, GPT-5.6 and GPT-6 models, and regional (data residency) endpoints add 10% for models released on or after March 5, 2026.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trim what is left, then route per request.&lt;/strong&gt; Shorten prompts and history, and only then consider sending some calls to other providers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The rest of this post goes through the six main fixes in order of effort, then the newer settings (Flex, reasoning effort, Batch limits), current prices, a cost formula and the measuring code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 1: Model Downgrade (Zero Engineering Effort)
&lt;/h2&gt;

&lt;p&gt;The biggest single lever is also the easiest to pull. If your application is using GPT-5.4 ($2.50/$15.00) for tasks that do not require frontier reasoning, GPT-5.4 mini ($0.75/$4.50) costs 3.3 times less on both input and output. That is not a rounding error. A workload costing $3,000 per month on GPT-5.4 costs roughly $900 per month on GPT-5.4 mini for the same call volume, if the cheaper model passes your test.&lt;/p&gt;

&lt;p&gt;The same logic applies one generation up. OpenAI's models page points to GPT-6 Astra ($10.00/$50.00) for complex reasoning and coding, GPT-6.1 Sol ($2.00/$10.00) to balance intelligence and cost, and GPT-6 Luna ($0.10/$0.50) for cost-sensitive, high-volume workloads. Astra to 6.1 Sol is 5 times cheaper per token. 6.1 Sol to Luna is another 20 times.&lt;/p&gt;

&lt;p&gt;The practical test is simple: run 200 representative samples from your production traffic through both models. Score the outputs using whatever quality metric matters for your use case: accuracy on a labeled test set, human review ratings, downstream task performance. Classification, extraction, summarization, and Q&amp;amp;A with well-defined source context are where a cheaper model most often holds up, but how close it gets depends on your prompts, and OpenAI does not publish a gap you can rely on for your task. Let your own eval decide. For tasks requiring complex multi-step reasoning, extended chains of logic, or synthesis across long documents, expect a larger gap.&lt;/p&gt;

&lt;p&gt;If you are running GPT-5.4 mini today and looking to go further, GPT-6 Luna at $0.10 per million input tokens and $0.50 per million output tokens is 7.5 times cheaper on input and 9 times cheaper on output. It also costs less than GPT-4o-mini ($0.15/$0.60). A workload costing $900 per month on GPT-5.4 mini would cost roughly $100 to $120 per month on GPT-6 Luna for the same tokens, if the task allows it. One catch: GPT-5.4 mini defaults to no reasoning, while GPT-6 Luna defaults to &lt;code&gt;medium&lt;/code&gt; reasoning effort, and reasoning tokens are billed as output. Set the effort you need before you compare (Luna accepts &lt;code&gt;none&lt;/code&gt;). Run the eval and find out. The downside of a failed experiment is a few hours of engineering time. The "GPT-4o vs GPT-4o-mini" section below gives a framework for making this decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 2: Output Length Control (Low Engineering Effort)
&lt;/h2&gt;

&lt;p&gt;Output tokens cost more than input tokens on every GPT and o-series model on OpenAI's price list. On GPT-5.4, output costs $15.00 per million versus $2.50 per million for input, a 6:1 ratio. On the GPT-6 models it is 5:1 (GPT-6.1 Sol: $10.00 versus $2.00). On GPT-4o-mini, it is $0.60 versus $0.15, a 4:1 ratio. Reducing output token count has an outsized impact on total cost compared to reducing input by the same amount.&lt;/p&gt;

&lt;p&gt;Adding output constraints to your existing prompts takes 10 minutes and costs nothing. "Respond in under 100 words" cuts verbose responses. "Return only the JSON object, no explanation or preamble" eliminates all the conversational wrapper around structured outputs. "Use at most three sentences" bounds conversational replies. If your application currently generates 300 tokens of output on average and these constraints bring it to 180 tokens, you have cut output costs by 40%. On a $2,000 monthly OpenAI bill where 70% is output token cost, that is $560 per month saved from prompt edits.&lt;/p&gt;

&lt;p&gt;On reasoning models, the output also includes thinking you never see. OpenAI bills reasoning tokens as output tokens, and depending on the problem a model can generate anywhere from a few hundred to tens of thousands of them. Two settings help. &lt;code&gt;reasoning.effort&lt;/code&gt; is covered in the Flex and reasoning section below. &lt;code&gt;max_output_tokens&lt;/code&gt; caps reasoning and visible output together, so leave room: if the model hits the cap while still reasoning, the response comes back incomplete and you have still paid for the input and the reasoning. The Responses API also has a &lt;code&gt;text.verbosity&lt;/code&gt; setting that changes how much detail the model writes.&lt;/p&gt;

&lt;p&gt;Test the constrained prompts against your quality metric before deploying. For many structured tasks, shorter outputs are not worse outputs, they are more direct outputs. The model can often answer the question in 100 words. The extra 200 tokens are hedging, context-setting, and preamble that your application discards anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 3: Prompt Caching (Medium Engineering Effort)
&lt;/h2&gt;

&lt;p&gt;OpenAI's prompt caching is on by default for supported models, but a cache hit is not guaranteed and the discount depends on the model. Cached input costs 50% less on GPT-4o and GPT-4o-mini, 90% less on the GPT-5 and GPT-6 models (GPT-5.4: $0.25 instead of $2.50 per million), and 95% less on GPT-6.1 Sol. From GPT-5.6 on there is also a write charge: putting a prefix into the cache costs 1.25 times the normal input rate. So caching pays when a prefix is reused. OpenAI's own example: one write and nine full reads cost 2.15 times the ordinary input cost of that prefix, against 10 times without caching.&lt;/p&gt;

&lt;p&gt;The requirement is structural. Stable content (the system prompt, tool definitions, shared reference material) goes first, and anything that changes, such as timestamps or user-specific data, goes at the end. On GPT-5.6 and later the shared prefix must be at least 1,024 tokens; on earlier models the minimum varies with request settings. A cached prefix on GPT-5.6 and later stays available for at least 30 minutes after it was last written or reused.&lt;/p&gt;

&lt;p&gt;One catch on the newer models. With implicit caching, OpenAI places the cache breakpoint at the end of the latest eligible message, which in a simple request is the user message. If every request is the same system prompt followed by a different user message, the shared system prompt on its own is not reused. OpenAI's fix is an explicit breakpoint (&lt;code&gt;prompt_cache_breakpoint&lt;/code&gt;) after the static part, which works on GPT-5.6 and later. Changing tools, &lt;code&gt;reasoning.effort&lt;/code&gt; or &lt;code&gt;text.verbosity&lt;/code&gt; between requests can also break the match. Check &lt;code&gt;usage.input_tokens_details.cached_tokens&lt;/code&gt; instead of assuming caching works.&lt;/p&gt;

&lt;p&gt;The savings add up for high-volume workloads with consistent system prompts. Consider a workload on GPT-6 Luna with a 2,000-token system prompt and 50,000 calls per day. Uncached input cost for the system prompt alone: 2,000 times 50,000 divided by 1,000,000 times $0.10 equals $10 per day. Now assume 9 in 10 calls read the prompt from the cache at $0.01 per million and 1 in 10 writes it again at $0.125 per million. That is $0.90 plus $1.25, or $2.15 per day. The saving is $7.85 per day, about $235 per month, from a stable prompt and one breakpoint. The 9-in-10 hit rate is an assumption: OpenAI's guide reports example deployments at about 70% and above 90% and says real rates depend on your application.&lt;/p&gt;

&lt;p&gt;Anthropic's Claude models also discount cached input, under their own pricing rules. If you are evaluating whether to stay on OpenAI or move some workloads with large, stable system prompts to Anthropic, compare the cached rates on both sides, not just the list prices. The &lt;a href="https://www.promptunit.ai/blog/prompt-caching-cost-savings-openai-anthropic" rel="noopener noreferrer"&gt;prompt caching cost savings guide&lt;/a&gt; covers both providers in detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 4: Prompt Compression (Medium Engineering Effort)
&lt;/h2&gt;

&lt;p&gt;After caching, the next target is the non-cached portions of your prompt: the user-specific context, the conversation history, and the query itself. Prompt compression applies systematic token reduction to this content before it reaches the API.&lt;/p&gt;

&lt;p&gt;The three highest-impact compression techniques are system prompt consolidation (removing redundant instructions), context trimming (summarizing or truncating old conversation turns), and few-shot reduction (testing whether fewer examples maintain quality). How much they save depends on how much padding your prompts carry today.&lt;/p&gt;

&lt;p&gt;A concrete example: a summarization endpoint with a 1,200-token system prompt, 2,800-token document context, and 500-token user query totals 4,500 tokens per call. After compression: 400-token system prompt, 1,400-token trimmed context, 300-token query totals 2,100 tokens. A 53% reduction. At $2.50 per million input tokens on GPT-5.4 and 100,000 calls per month, that is $600 per month in input cost savings from prompt optimization. For the detailed technique breakdown, see &lt;a href="https://www.promptunit.ai/blog/llm-token-reduction-techniques" rel="noopener noreferrer"&gt;LLM token reduction techniques&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Two caveats from OpenAI's caching guide. Summarizing or truncating conversation history changes the prompt prefix and can reset cache reuse, so compare total input cost before and after, not just token counts. And on GPT-5.6 and later a prefix under 1,024 tokens is not cached at all: cutting a 1,200-token system prompt to 400 tokens can turn a discounted cached prefix into a full-price one. Fewer tokens can still come out cheaper. Measure it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 5: Cross-Provider Routing (Higher Engineering Effort)
&lt;/h2&gt;

&lt;p&gt;OpenAI is not always the right provider for every call. For tasks where an alternative model performs adequately, routing those calls to a cheaper provider can produce substantial savings. The question is which tasks qualify.&lt;/p&gt;

&lt;p&gt;The usual candidates for classification, extraction, and simple Q&amp;amp;A are the low-cost tiers at other providers, such as Google's Gemini Flash-Lite models and Anthropic's Claude Haiku models. Their prices change often, so check today's numbers on the &lt;a href="https://www.promptunit.ai/ai-api-pricing/gemini-3-5-flash-lite" rel="noopener noreferrer"&gt;Gemini 3.5 Flash-Lite&lt;/a&gt; and &lt;a href="https://www.promptunit.ai/ai-api-pricing/claude-haiku-5-5" rel="noopener noreferrer"&gt;Claude Haiku 5.5&lt;/a&gt; price pages rather than a table in a blog post, this one included. Before you add a second provider, compare against OpenAI's own cheap tier: GPT-6 Luna costs $0.10 per million input tokens and $0.50 per million output tokens. Cheaper is not automatically good enough, either. In our own early checks below, a cheaper model was judged worse on a research step.&lt;/p&gt;

&lt;p&gt;Cross-provider routing requires maintaining API integrations with multiple providers and building quality validation for the routed calls. It is more engineering work than the earlier options, but for high-volume workloads, the payoff is proportionally larger. See &lt;a href="https://www.promptunit.ai/blog/llm-model-routing-guide" rel="noopener noreferrer"&gt;the cross-provider LLM routing guide&lt;/a&gt; for implementation patterns that handle fallback, quality scoring, and provider selection logic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 6: Batch API (Higher Effort for Some Teams, Easy for Others)
&lt;/h2&gt;

&lt;p&gt;OpenAI's Batch API takes 50% off standard rates on the models that support it, which is most of them. Requests are submitted in bulk as a file, and each batch completes within 24 hours, often sooner. For workloads that do not require real-time responses, this is one of the simplest cost reductions available.&lt;/p&gt;

&lt;p&gt;The use cases that qualify for batching are broader than most teams assume. Nightly data enrichment pipelines, content moderation queues, document classification for uploaded files, embedding generation, and analytics processing are all candidates. If a workload runs on a schedule or processes a queue rather than responding to live user requests, it likely qualifies.&lt;/p&gt;

&lt;p&gt;The code change is small: write the requests to a &lt;code&gt;.jsonl&lt;/code&gt; file, upload it, create the batch, and collect the results when it finishes. For a workload currently costing $2,000 per month that can be moved to batch, the savings are $1,000 per month. The implementation often takes a day. If a file and a 24-hour window do not fit your job, Flex processing (next section) gives the same 50% rate on ordinary requests. For more on the routing decision between batch and real-time, see &lt;a href="https://www.promptunit.ai/blog/batch-api-50-percent-routing-decision" rel="noopener noreferrer"&gt;the batch API routing decision guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flex processing, reasoning effort and Batch limits
&lt;/h2&gt;

&lt;p&gt;Three settings that change the bill without changing the model. All the facts here are from OpenAI's &lt;a href="https://developers.openai.com/api/docs/guides/flex-processing" rel="noopener noreferrer"&gt;Flex processing&lt;/a&gt;, &lt;a href="https://developers.openai.com/api/docs/guides/reasoning" rel="noopener noreferrer"&gt;reasoning&lt;/a&gt; and &lt;a href="https://developers.openai.com/api/docs/guides/batch" rel="noopener noreferrer"&gt;Batch API&lt;/a&gt; guides.&lt;/p&gt;

&lt;h3&gt;
  
  
  Flex processing: Batch prices on ordinary requests
&lt;/h3&gt;

&lt;p&gt;Set &lt;code&gt;service_tier&lt;/code&gt; to &lt;code&gt;"flex"&lt;/code&gt; on a normal Responses or Chat Completions request, and the tokens are billed at Batch API rates, half the standard price, with prompt caching discounts on top. The trade is slower responses and occasional resource unavailability. Flex is in beta with limited model availability. On the pricing page today that includes the GPT-6, GPT-6.1, GPT-5.6, GPT-5.5 and GPT-5.4 models, but not GPT-4o or GPT-4o-mini.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;with_options&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;900.0&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-6-luna&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Summarize this support thread in two sentences: ...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;service_tier&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;flex&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When capacity runs short, Flex returns a &lt;code&gt;429 Resource Unavailable&lt;/code&gt; error, and OpenAI does not charge for that request. Retry with exponential backoff if the job can wait, or retry with &lt;code&gt;service_tier&lt;/code&gt; set to &lt;code&gt;"auto"&lt;/code&gt; to pay the standard rate and get the answer now. Raise the SDK timeout as well: the default is 10 minutes, and OpenAI's own example uses 15 (the 900 seconds above).&lt;/p&gt;

&lt;p&gt;Flex fits jobs that already run as ordinary API calls and can wait: model evaluations, data enrichment, background summaries. Batch fits large offline jobs you can package into a file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reasoning effort: the output tokens you do not see
&lt;/h3&gt;

&lt;p&gt;The GPT-6 and GPT-5.6 models are reasoning models. They think in reasoning tokens before they answer, and OpenAI bills those as output tokens even though the API does not return them. &lt;code&gt;reasoning.effort&lt;/code&gt; sets how much they think: lower effort favors speed and fewer tokens, higher effort a more thorough answer.&lt;/p&gt;

&lt;p&gt;The defaults matter if you never set it. GPT-5.5, GPT-5.6, GPT-6 Sol, GPT-6.1 Sol and GPT-6 Luna all default to &lt;code&gt;medium&lt;/code&gt;. Accepted values differ by model: GPT-6 Luna accepts &lt;code&gt;none&lt;/code&gt;, GPT-6 Astra does not, GPT-6.1 Sol starts at &lt;code&gt;low&lt;/code&gt;, and GPT-5.4 mini and nano default to &lt;code&gt;none&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For classification, extraction and short replies, test &lt;code&gt;low&lt;/code&gt; or &lt;code&gt;none&lt;/code&gt; against the default on a sample and compare quality and cost.&lt;/li&gt;
&lt;li&gt;Read &lt;code&gt;usage.output_tokens_details.reasoning_tokens&lt;/code&gt; to see how much of each answer was thinking.&lt;/li&gt;
&lt;li&gt;If you set &lt;code&gt;max_output_tokens&lt;/code&gt;, remember it includes reasoning. OpenAI suggests reserving at least 25,000 tokens for reasoning and output when you start, then tightening once you know your numbers.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;reasoning.mode: "pro"&lt;/code&gt; on GPT-5.6 and GPT-6 models does more work per answer and bills it at standard token rates, so the same request costs more. Use it where your evals show it pays.&lt;/li&gt;
&lt;li&gt;Changing &lt;code&gt;reasoning.effort&lt;/code&gt; between requests can break prompt caching. On GPT-6 models, OpenAI's guide shows how to change effort mid-conversation with a &lt;code&gt;configuration_update&lt;/code&gt; input item that keeps the cached prefix.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Batch API limits worth knowing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A batch can hold up to 50,000 requests, and the input file can be up to 200 MB. Each file can only target one model.&lt;/li&gt;
&lt;li&gt;The only completion window is 24 hours. If a batch expires, unfinished requests are cancelled and you pay for the ones that completed.&lt;/li&gt;
&lt;li&gt;Batch has its own rate-limit pool, so it does not use up your standard per-model limits. You can create up to 2,000 batches per hour.&lt;/li&gt;
&lt;li&gt;Output files are deleted 30 days after the batch completes, so download them.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Processing&lt;/th&gt;
&lt;th&gt;Price vs standard&lt;/th&gt;
&lt;th&gt;How you use it&lt;/th&gt;
&lt;th&gt;Fits&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Standard&lt;/td&gt;
&lt;td&gt;1x&lt;/td&gt;
&lt;td&gt;The default&lt;/td&gt;
&lt;td&gt;Live user requests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flex (beta)&lt;/td&gt;
&lt;td&gt;0.5x&lt;/td&gt;
&lt;td&gt;&lt;code&gt;service_tier: "flex"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Evals, enrichment, background jobs that can wait&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Batch&lt;/td&gt;
&lt;td&gt;0.5x&lt;/td&gt;
&lt;td&gt;Upload a &lt;code&gt;.jsonl&lt;/code&gt; file, 24-hour window&lt;/td&gt;
&lt;td&gt;Large offline jobs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fast (Priority until July 30, 2026)&lt;/td&gt;
&lt;td&gt;2x on GPT-5.4, GPT-5.6 and GPT-6 models&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;service_tier: "fast"&lt;/code&gt; or a project setting&lt;/td&gt;
&lt;td&gt;User-facing traffic where speed is worth paying for&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Fast mode deserves a check of its own. OpenAI lets you set Fast as a project's default service tier, and requests that do not name a tier then run in Fast mode at the higher price. If your bill looks double what the token counts suggest, look at the project setting.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Combined Savings Look Like
&lt;/h2&gt;

&lt;p&gt;This is an illustration with assumed percentages, not a measurement. Your numbers depend on your traffic, and each step only applies where quality holds. Applying all six options in sequence to an example high-volume workload:&lt;/p&gt;

&lt;p&gt;Starting point: $5,000 per month on GPT-5.4 for mixed classification, extraction, and generation workloads.&lt;/p&gt;

&lt;p&gt;Model downgrade (classification and extraction to GPT-5.4 mini or GPT-6 Luna where quality holds): saves 50 to 60% of those workloads' costs. New baseline: roughly $3,200 per month.&lt;/p&gt;

&lt;p&gt;Output length control: reduces output costs by 35% across all remaining workloads. New baseline: roughly $2,500 per month.&lt;/p&gt;

&lt;p&gt;Prompt caching: assume the repeated system prompt is read from the cache on most calls. Cached input on GPT-5.4 costs $0.25 instead of $2.50 per million, and here that trims roughly another 15% of the remaining bill. New baseline: roughly $2,100 per month.&lt;/p&gt;

&lt;p&gt;Prompt compression: reduces variable token count by 40%. New baseline: roughly $1,500 per month.&lt;/p&gt;

&lt;p&gt;Batching or Flex for workloads that can wait: cuts those workloads' costs by 50%. New baseline: roughly $1,100 per month.&lt;/p&gt;

&lt;p&gt;Cross-provider routing for tasks that pass quality checks on cheaper models: reduces remaining workload costs by another 20 to 30%. Final baseline: roughly $800 per month.&lt;/p&gt;

&lt;p&gt;The path from $5,000 to $800 per month is not a single dramatic change. It is six incremental optimizations applied in order of effort. Each one compounds on the others. The first two take a day. The last two take a week or more. But the direction is clear, and the arithmetic adds up.&lt;/p&gt;




&lt;h2&gt;
  
  
  Current OpenAI API pricing (2026)
&lt;/h2&gt;

&lt;p&gt;Per million tokens, Standard tier, prompts up to 272K input tokens, from OpenAI's &lt;a href="https://developers.openai.com/api/docs/pricing" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt; and &lt;a href="https://developers.openai.com/api/docs/models" rel="noopener noreferrer"&gt;models page&lt;/a&gt; on October 16, 2026:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Cached input&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;th&gt;What OpenAI positions it for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-astra" rel="noopener noreferrer"&gt;GPT-6 Astra&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$50.00&lt;/td&gt;
&lt;td&gt;Most demanding work, complex reasoning and coding&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-1-sol" rel="noopener noreferrer"&gt;GPT-6.1 Sol&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;Balance of intelligence and cost&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-sol" rel="noopener noreferrer"&gt;GPT-6 Sol&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$0.20&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;Coding and agents (6.1 Sol is the newer Sol)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-6-luna" rel="noopener noreferrer"&gt;GPT-6 Luna&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;td&gt;$0.01&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;td&gt;Focused, high-volume tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-6-sol" rel="noopener noreferrer"&gt;GPT-5.6 Sol&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$4.00&lt;/td&gt;
&lt;td&gt;$0.40&lt;/td&gt;
&lt;td&gt;$20.00&lt;/td&gt;
&lt;td&gt;GPT-5.6 flagship (promotional price)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-6-terra" rel="noopener noreferrer"&gt;GPT-5.6 Terra&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$0.20&lt;/td&gt;
&lt;td&gt;$12.00&lt;/td&gt;
&lt;td&gt;Balance of intelligence and cost (GPT-5.6 mini tier)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-6-luna" rel="noopener noreferrer"&gt;GPT-5.6 Luna&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$0.20&lt;/td&gt;
&lt;td&gt;$0.02&lt;/td&gt;
&lt;td&gt;$1.20&lt;/td&gt;
&lt;td&gt;Cost-sensitive work (GPT-5.6 nano tier)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-5" rel="noopener noreferrer"&gt;GPT-5.5&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;td&gt;$30.00&lt;/td&gt;
&lt;td&gt;Earlier flagship for complex professional work&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-4" rel="noopener noreferrer"&gt;GPT-5.4&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;$0.25&lt;/td&gt;
&lt;td&gt;$15.00&lt;/td&gt;
&lt;td&gt;Coding and professional work&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-4-mini" rel="noopener noreferrer"&gt;GPT-5.4 mini&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$0.75&lt;/td&gt;
&lt;td&gt;$0.075&lt;/td&gt;
&lt;td&gt;$4.50&lt;/td&gt;
&lt;td&gt;High-volume work, coding, subagents&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-4-nano" rel="noopener noreferrer"&gt;GPT-5.4 nano&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$0.20&lt;/td&gt;
&lt;td&gt;$0.02&lt;/td&gt;
&lt;td&gt;$1.25&lt;/td&gt;
&lt;td&gt;Classification, extraction, ranking&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5" rel="noopener noreferrer"&gt;GPT-5&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$1.25&lt;/td&gt;
&lt;td&gt;$0.125&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;Previous reasoning model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-mini" rel="noopener noreferrer"&gt;GPT-5 mini&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$0.25&lt;/td&gt;
&lt;td&gt;$0.025&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;Cost-sensitive, high-volume work&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-5-nano" rel="noopener noreferrer"&gt;GPT-5 nano&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$0.05&lt;/td&gt;
&lt;td&gt;$0.005&lt;/td&gt;
&lt;td&gt;$0.40&lt;/td&gt;
&lt;td&gt;Lowest per-token price in this table&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-4o" rel="noopener noreferrer"&gt;GPT-4o&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;$1.25&lt;/td&gt;
&lt;td&gt;$10.00&lt;/td&gt;
&lt;td&gt;Older general-purpose model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/gpt-4o-mini" rel="noopener noreferrer"&gt;GPT-4o-mini&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$0.15&lt;/td&gt;
&lt;td&gt;$0.075&lt;/td&gt;
&lt;td&gt;$0.60&lt;/td&gt;
&lt;td&gt;Older small model for focused tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.promptunit.ai/ai-api-pricing/o3" rel="noopener noreferrer"&gt;o3&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$2.00&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;td&gt;$8.00&lt;/td&gt;
&lt;td&gt;Older reasoning model, succeeded by GPT-5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three things to notice. First, output tokens cost far more than input on every model (5:1 on the GPT-6 models, 6:1 on GPT-5.4), which is why output length control (Option 2) punches above its weight. Second, the gap between GPT-6 Astra and GPT-6 Luna is 100x, which is the whole reason model choice (Option 1) is the biggest lever. Third, newer is not always pricier: GPT-6.1 Sol costs less per token than GPT-5.4, GPT-5.5 and GPT-5.6 Sol, and less than GPT-5.6 Terra on output.&lt;/p&gt;

&lt;p&gt;On top of the list prices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Batch and Flex:&lt;/strong&gt; 50% off standard on the models that support them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt caching:&lt;/strong&gt; cached input costs 50% less on GPT-4o and GPT-4o-mini, 75% less on GPT-4.1 and o3, 90% less on the GPT-5 and GPT-6 models, and 95% less on GPT-6.1 Sol. On GPT-5.6 and later, cache writes cost 1.25 times the input price.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long prompts:&lt;/strong&gt; above 272K input tokens, GPT-5.4, GPT-5.5, GPT-5.6 and GPT-6 models charge twice the input price and 1.5 times the output price.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fast mode&lt;/strong&gt; (called Priority processing until July 30, 2026): 2x the standard price on the GPT-5.4, GPT-5.6 and GPT-6 models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regional processing&lt;/strong&gt; (data residency) endpoints: 10% more for models released on or after March 5, 2026.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT-5.6 Sol's&lt;/strong&gt; $4.00/$20.00 is a promotional price that OpenAI says runs at least through November 21, 2026.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you buy OpenAI models through Azure instead, they are billed through Azure, not OpenAI. The &lt;a href="https://www.promptunit.ai/blog/azure-openai-vs-openai-direct-cost-comparison" rel="noopener noreferrer"&gt;Azure OpenAI pricing comparison&lt;/a&gt; has the side-by-side table and a worked monthly example. Note that the data residency surcharge is not Azure-only: OpenAI's own regional processing endpoints add 10% on newer models, as listed above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Estimate your monthly cost
&lt;/h2&gt;

&lt;p&gt;The formula is straightforward:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;monthly cost = calls per month × (avg input tokens × input price + avg output tokens × output price) ÷ 1,000,000&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Worked example, 200,000 calls per month at 1,000 input and 500 output tokens each:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On &lt;strong&gt;GPT-6 Astra&lt;/strong&gt;: 200,000 × (1,000 × $10.00 + 500 × $50.00) ÷ 1,000,000 = &lt;strong&gt;$7,000/month&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;GPT-5.4&lt;/strong&gt;: 200,000 × (1,000 × $2.50 + 500 × $15.00) ÷ 1,000,000 = &lt;strong&gt;$2,000/month&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;GPT-6.1 Sol&lt;/strong&gt;: the same volume is about &lt;strong&gt;$1,400/month&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;GPT-5.4 mini&lt;/strong&gt;: about &lt;strong&gt;$600/month&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;GPT-4o-mini&lt;/strong&gt; (where the task allows): about &lt;strong&gt;$90/month&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;GPT-6 Luna&lt;/strong&gt; (where the task allows): about &lt;strong&gt;$70/month&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The distance between those rows is the opportunity. One warning: on reasoning models, the 500 output tokens must include the reasoning tokens, and at the default &lt;code&gt;medium&lt;/code&gt; effort the real number can be much higher than the visible answer. The only way to know which row your traffic can safely sit in, and what it really costs there, is to measure it per task, not per app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measure first: log what each request really costs
&lt;/h2&gt;

&lt;p&gt;Before you change models or settings, record the real cost of each call. The Responses API returns everything you need in &lt;code&gt;response.usage&lt;/code&gt;: &lt;code&gt;input_tokens&lt;/code&gt;, &lt;code&gt;input_tokens_details.cached_tokens&lt;/code&gt; and, on GPT-5.6 and later, &lt;code&gt;input_tokens_details.cache_write_tokens&lt;/code&gt;, plus &lt;code&gt;output_tokens&lt;/code&gt; and &lt;code&gt;output_tokens_details.reasoning_tokens&lt;/code&gt;. This Python function turns that into dollars:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# USD per 1M tokens, Standard tier, prompts up to 272K input tokens.
# From developers.openai.com/api/docs/pricing on Oct 16, 2026. Recheck before you rely on them.
&lt;/span&gt;&lt;span class="n"&gt;PRICES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-6.1-sol&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cached&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;write&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;10.00&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-6-luna&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cached&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;write&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.125&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.50&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-5.4-mini&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cached&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.075&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;write&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;4.50&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;  &lt;span class="c1"&gt;# no write charge before GPT-5.6
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;request_cost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PRICES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;details&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_tokens_details&lt;/span&gt;
    &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cached_tokens&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;written&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getattr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;details&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_write_tokens&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;uncached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_tokens&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;written&lt;/span&gt;
    &lt;span class="n"&gt;reasoning&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_tokens_details&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reasoning_tokens&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;cost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;uncached&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cached&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;written&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;write&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_tokens&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;  &lt;span class="c1"&gt;# output_tokens already includes reasoning tokens
&lt;/span&gt;    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1_000_000&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cost_usd&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_hit_rate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_tokens&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_tokens&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;reasoning_tokens&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;reasoning&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output_tokens&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_tokens&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-6-luna&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;reasoning&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;effort&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;low&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;developer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Label the support ticket as billing, bug or other. Reply with the label only.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;I was charged twice this month.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;request_cost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Log that result with a feature name for every call, then add it up per feature per day. Three numbers tend to explain a high bill: which features cost the most, how much of the input comes from the cache, and how much of the output is reasoning. Fix the biggest one first. The &lt;a href="https://www.promptunit.ai/blog/llm-cost-tracking-guide" rel="noopener noreferrer"&gt;LLM cost tracking guide&lt;/a&gt; covers storing and grouping these numbers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Not sure which of these fixes matters most for you?&lt;/strong&gt; PromptUnit shows the cost of every request and checks which ones a cheaper model can answer just as well. You change two settings, the API base URL and a PromptUnit key (your own OpenAI key stays), and it is free until it has saved you $5 (individual accounts) or $100 (business accounts with a work email). &lt;a href="https://www.promptunit.ai/sign-up" rel="noopener noreferrer"&gt;Start free&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  GPT-4o vs GPT-4o-mini: when the cheaper model wins
&lt;/h2&gt;

&lt;p&gt;GPT-4o-mini is about 16.7 times cheaper than GPT-4o on both input and output ($0.15 versus $2.50 per million input tokens, $0.60 versus $10.00 output). For a large share of production work, the cheaper model can hold up, but only your own test can tell you where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Where mini is most likely to hold up:&lt;/strong&gt; summarization, classification and intent detection, structured extraction with a clear schema, and well-scoped customer support replies. These are bounded tasks with a checkable right answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Where GPT-4o is more likely to earn its price:&lt;/strong&gt; multi-step reasoning, non-trivial code generation, long-context synthesis, and brand-sensitive creative work.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The decision rule is simple: send the bounded, verifiable tasks to mini and keep the open-ended, high-stakes ones on the stronger model. Do not switch blind, run a sample of your real traffic through both and compare on your own quality metric before you move anything.&lt;/p&gt;

&lt;p&gt;Both are older models now. If you are choosing today, the same split applies one generation up: GPT-6 Luna ($0.10/$0.50) costs less than GPT-4o-mini on both input and output, and GPT-6.1 Sol ($2.00/$10.00) costs less than GPT-4o on input and the same on output. The newer models are reasoning models, though, and reasoning tokens are billed as output, so compare cost per request on your own traffic, not just the price per token.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we measured
&lt;/h2&gt;

&lt;p&gt;We do not have to argue this from theory. With PromptUnit's optional side-by-side checks, after the answer has gone back to the app, cheaper models answer a sample of its real requests and the model the app asked for judges whether each cheaper answer is as good. This is early data from one production account:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;From October 2 to 7, 2026, about &lt;strong&gt;83%&lt;/strong&gt; of its 183 live requests were simple question-answering and about 6% were heavy reasoning or complex code. PromptUnit's own classifier assigns these task types, so they are approximate.&lt;/li&gt;
&lt;li&gt;In 24 side-by-side comparisons (October 5 to 7), a cheaper model matched or beat the chosen one 18 times (&lt;strong&gt;75%&lt;/strong&gt;), at roughly &lt;strong&gt;89% lower&lt;/strong&gt; cost on those calls. Claude Sonnet 5 to GPT-5.4 mini matched 8 of 10. The judge was Claude Sonnet 5, the model the app had asked for, so it is not independent.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In an app the PromptUnit team runs itself (checks up to October 12, 2026, again judged by Claude Sonnet 5, the model the app asked for), GPT-5.4 mini was judged as good on the app's video-prompt step in 23 of 23 checks, at about 73% lower cost. On its web-research step, Claude Haiku 4.5 was judged worse than Sonnet 5 in 2 of 3 checks, so PromptUnit kept that step on Sonnet 5. Claude Haiku 5.5 was judged as good in only 4 of 8 checks on the same step. Cheaper models win on some steps and lose on others, which is why the test has to be per step, not per app.&lt;/p&gt;

&lt;p&gt;Across the whole bill, the measured drop on the live account is about 11%, because most of its spend is long writing steps that stay on the stronger model. For a workload with many simple requests, we estimate a 40 to 70 percent reduction across the bill. That is an estimate, not a measurement.&lt;/p&gt;

&lt;p&gt;The samples are small, so treat them as a signal, not a benchmark. The method and limits are in &lt;a href="https://www.promptunit.ai/blog/gpt4-calls-analysis-model-routing" rel="noopener noreferrer"&gt;What We Measured Routing GPT-4o Traffic to Cheaper Models&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.promptunit.ai%2Fblog%2Fcharts%2Fproduction-traffic-mix.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.promptunit.ai%2Fblog%2Fcharts%2Fproduction-traffic-mix.svg" alt="Most production AI traffic is simple question-answering, with only a few percent needing reasoning or complex code." width="620" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is the pattern behind every fix above: most of the bill is spent on calls that are simpler than the model running them. &lt;a href="https://www.promptunit.ai/blog/hidden-cost-of-defaulting-to-gpt4" rel="noopener noreferrer"&gt;The hidden cost of defaulting to your flagship model&lt;/a&gt; turns that into dollars per month of waiting.&lt;/p&gt;

&lt;p&gt;PromptUnit automates the per-request part of options 1 and 5: it checks each call, and when a cheaper model is just as good for that request, including one at another provider whose key you connected, it uses that model; otherwise the call goes to the model you asked for. You change two settings, your API base URL and your PromptUnit key, instead of building the routing yourself.&lt;/p&gt;

&lt;p&gt;If your OpenAI bill has grown faster than your usage or revenue, &lt;a href="https://www.promptunit.ai" rel="noopener noreferrer"&gt;PromptUnit&lt;/a&gt; gives you the per-call cost data to identify where to apply these optimizations first.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How do I reduce OpenAI API costs?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Measure what each request costs first, then work down the list: move simple tasks to a cheaper model after testing a sample of real traffic (GPT-6 Luna costs $0.10 per million input tokens and $0.50 per million output tokens), set reasoning effort per task, cap output length, put stable content first so prompt caching hits, and send work that can wait to Flex processing or the Batch API at half the standard rate. None of this requires leaving OpenAI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is my OpenAI API cost so high in the first place?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Usually it's one default nobody revisited: every call goes to the flagship model regardless of task, output length is uncapped, reasoning effort stays at the default even for simple tasks, and caching either isn't set up or isn't structured to actually hit. None of those are hard problems, they just need someone to look.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do I need to switch away from OpenAI to fix a high API bill?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. Five of the six fixes here work entirely within OpenAI. Cross-provider routing is the one exception, and it comes late in the list because it's the most engineering work for the least additional savings once the other fixes are in place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How fast can I see savings after fixing a too-high OpenAI API cost?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Model downgrade and output length control are same-day changes that need little engineering. Test quality on a sample of real requests first. Once they are live, you'll see the drop on your next invoice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is OpenAI prompt caching automatic?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is on by default for supported models, but a cache hit is not guaranteed. Requests must start with the same content, and on GPT-5.6 and later the shared prefix must be at least 1,024 tokens. On those models a cache read costs 10% of the input price (5% on GPT-6.1 Sol) and a cache write costs 1.25 times the input price. If each request is a fixed system prompt plus a new user message, add an explicit cache breakpoint after the fixed part. Check usage.input_tokens_details.cached_tokens to see what was actually cached.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is OpenAI Flex processing?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Flex is a service tier for requests that can wait. You set service_tier to flex on a normal Responses or Chat Completions request and pay Batch API rates, which are half the standard price. Responses are slower, and when capacity is short you get a 429 Resource Unavailable error, which OpenAI does not charge for. Flex is in beta and only some models support it, including the GPT-6, GPT-5.6, GPT-5.5 and GPT-5.4 models.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>openaicost</category>
    </item>
  </channel>
</rss>
