

I spent $340 in one week on full codebase scans with Claude Opus 4.6. The same work cost me under $2 on DeepSeek V3.2, and its automatic input caching did most of that. Here is how to reduce AI costs with that gap.
A per-call cost has two inputs, the model and the tokens. This post fixes the model. It gives you five steps and one worked calculation, with every price dated.
TLDR
Cost per call is the price per token times the tokens, so pick the model first and trim the tokens second.
On 2026-10-13 the top paid tier lists at 100 times the price of the bottom paid tier, on input and on output.
Log the model and the token counts per task for one week, then move every task with no quality gap down one tier.
A gateway retries a failed request on a backup model and prices it at the model that answered.
In the worked example, routing 90% of 10,000 daily queries to a cheap tier cuts $1,500 to $328, and the escalated 10% is 46% of the new bill.
One Week of Scans Cost $340 on Opus and Under $2 on DeepSeek
Here is the same week of work in two setups.

Before, scans, repeat scans, debugging loops and architecture reviews all went to one frontier model. Opus 4.6 lists at $5 per million input tokens and $25 per million output tokens (Anthropic pricing page, 2026-10-13). That week cost $340.
After, scans and boilerplate went to DeepSeek V3.2 with a cached prefix. Opus kept only the final debugging pass. The same scans cost under $2, which is about 170 times less.
Nate Herk explains Anthropic's advisor strategy, where Sonnet or Haiku does the work and calls Opus only when a step needs it.
Step 1. List Which Model Does Which Task
Log three numbers per call for one week: the model name, the input tokens and the output tokens. The API response reports the token counts, so this takes one line of logging code.
Then group the calls by task type and multiply tokens by price:
Codebase scans and repeat scans
Boilerplate and first drafts
Classification and extraction
Debugging and architecture review
The list shows which task type costs the most. Start there.
Watch out. Claude 4.7 and later models use a newer tokenizer that produces about 30% more tokens for the same text (Anthropic pricing page, 2026-10-13). Compare the cost per task, because the price per token alone misleads.
For the habit behind a growing token bill, read Token Anxiety And The Illusion Of Productivity.
Step 2. Move Each Task to the Cheapest Tier That Passes
Prices fall into five tiers. Each step down costs less, and the top paid tier costs 100 times the bottom paid tier.

To move a task down one tier, run the test below:
Take 20 real inputs for one task type from your log.
Run them on your current model and on the next tier down.
Score both outputs with your own check, such as a test suite or a reviewer.
If the cheaper tier shows no gap, move the task.
Rule of thumb. Start every new use case on the cheapest tier that passes your check. Escalate only when you can show a measurable quality gap.
Two prices matter on the efficient tier. Claude Haiku 5.5 lists at $0.10 in and $0.50 out for prompts up to 100,000 tokens, and $0.50 and $2.50 above that. DeepSeek lists cache-hit input at $0.003 against $0.15 on a miss, off-peak, which is 50 times cheaper on repeated text. A cached prefix is why my scans cost so little. Both prices come from the provider pages, read on 2026-10-13.
Tier 5 costs nothing per token. Ollama runs open-weight models on your own machine, for work no customer sees, such as prototyping and code exploration.

Two videos show the local route in practice.
AI Factory shows how to run OpenClaw on a local model with no API tokens.
A local model does not need a strong GPU.
The AISphere shows an offline model running on a GTX 1650 through LM Studio.
I once spent over $100 a day running a frontier model inside Cursor or Replit for whole codebase scans.
I moved discovery and boilerplate to free local models and kept the frontier model for the final debugging pass. That cut the bill to under $5 a day. For the cost cut on a full system, read AI-First DevRel. 1M+ Organic Traffic and a 90% Cost Cut.
Step 3. Put a Gateway in Front so an Outage Does Not Stop Your Product
A gateway is one endpoint that forwards your request to many model providers. OpenRouter hosts one. LiteLLM is an open source one that you run yourself, behind one OpenAI-shaped interface.

OpenRouter takes a list of models in priority order. Any error can trigger the next model, such as a rate limit, downtime or a context length error. It prices the request at the model that finally answered, and the response names that model. The docs do not say how a failed attempt is billed, so check your own activity log.

You can also sort providers by price, throughput or latency. A throughput threshold such as p90: 50 prefers providers above 50 tokens per second for 90% of requests in the last 5 minutes. The threshold is a preference, so a provider that misses it moves to the end of the list.
Tip. Put the cheap model first in the list and a reliable model second. You pay cheap prices on most requests, and a failure still returns an answer.
Step 4. Route Easy Traffic Away From the Expensive Model
Set up a small classifier at the front of your pipeline. Easy queries go to the efficient tier, and hard queries escalate to a standard or frontier model. The RouteLLM team at Arena published a router trained on human preference data.
Its authors report cost reductions of over 85% on MT Bench and 45% on MMLU (Arena post, 2024-07-01).
Here is the arithmetic for a support bot with 10,000 queries a day. Assume 1,000 input and 300 output tokens per query.

All traffic on Claude Sonnet 5.5 costs $1,500 a month at $2 in and $10 out. With 90% on DeepSeek Flash at its peak rate of $0.30 in and $1.20 out, the bill is $328, which is 78% lower. This is a calculation from listed prices. Your own token counts will move it.
Example. In this calculation the 10% that escalates costs $150, which is 46% of the new bill. Tighten what escalates before you look for a cheaper cheap model.
Step 5. Match the Plan to Your Volume
Your monthly volume decides which plan to build first.

Solo developer: run an open model locally for work no customer sees, and send production calls to a cheap tier.
Small team: add the classifier router from Step 4.
Enterprise: once daily volume is steady, reserve capacity. Azure provisioned throughput reservations run on a one-month or one-year term and give a lower effective hourly rate (Microsoft Learn, 2026-10-13). The discount varies by model family and term.
Work that can wait a day also runs at half price. Anthropic and OpenAI both list a 50% Batch API discount on input and output tokens (pricing pages, 2026-10-13). Part 3 covers the Batch API.
Four Questions Developers Ask About Model Costs
Which model should a new task start on? Start on the cheapest tier that passes your own check. Escalate when you can show a measurable quality gap.
Does a cheaper price per token always mean a cheaper task? No. Claude 4.7 and later models produce about 30% more tokens for the same text, so compare the cost per task from your log.
Do I need a gateway on day one? No. Run the audit and the tier test first. Add a gateway when a rate limit or an outage stops a task.
Are the prices on this page still right? They are dated 2026-10-13. Providers change prices and retire models, so open the provider's page before you commit. Anthropic lists Opus 4.1 as retired except on Amazon Bedrock and Google Cloud.
The Appendix Holds the Cost Script and the Fallback Request
The cost script behind the Step 4 figure. Set your own token counts, then run it.
# USD per 1M tokens, checked 2026-10-13 on each provider's pricing page
PRICE = {
"sonnet-5.5": (2.00, 10.00),
"deepseek-flash": (0.30, 1.20), # peak rate; off-peak is half
}
IN_TOK, OUT_TOK = 1_000, 300 # your own per-query average goes here
QUERIES, DAYS, CHEAP_SHARE = 10_000, 30, 0.90
def per_query(model):
p_in, p_out = PRICE[model]
return (IN_TOK * p_in + OUT_TOK * p_out) / 1_000_000
total = QUERIES * DAYS
all_big = total * per_query("sonnet-5.5")
routed = (total * CHEAP_SHARE * per_query("deepseek-flash")
+ total * (1 - CHEAP_SHARE) * per_query("sonnet-5.5"))
print(f"all on sonnet-5.5: ${all_big:,.0f} a month")
print(f"90% routed: ${routed:,.0f} a month")
print(f"saved: {1 - routed / all_big:.0%}")The output when I ran it on 2026-10-13:
all on sonnet-5.5: $1,500 a month
90% routed: $328 a month
saved: 78%Here is a fallback request body for OpenRouter. The models array holds model IDs in priority order, and the model names here are placeholders for your own pair.
{
"models": ["deepseek/your-cheap-model", "google/your-backup-model"],
"messages": [{ "role": "user", "content": "Summarize this file." }]
}Price sources, all read on 2026-10-13: the Anthropic, OpenAI, DeepSeek and Google AI pricing pages, the OpenRouter routing docs and the Microsoft Learn provisioned throughput billing page.
Next in the series is Part 2, on cutting the tokens you send.





