AI Model Pricing Explained: Why Claude Sonnet 5 Can Cost More Than Opus in Agents
Claude Sonnet 5 is cheaper per token but uses more tokens in agentic workflows. Learn how to calculate real AI model costs for your use case.
The Number That Fools Everyone
AI model pricing looks simple on the surface. Claude Sonnet 5 costs a fraction of what Claude Opus does per token. So for most tasks, Sonnet 5 is obviously the cheaper choice, right?
Not always — and the gap between “cheaper per token” and “cheaper to run” is where a lot of AI budgets quietly blow up.
If you’re building or running agentic AI workflows, Claude Sonnet 5 can end up costing more than Opus in practice. Not because of any pricing trick, but because of how agents actually consume tokens. Understanding this distinction is one of the most practically useful things you can learn about real-world AI model costs.
This post breaks down how per-token pricing works, why agentic use cases change the math, how to calculate what a model will actually cost for your workflow, and how to make smarter model selection decisions when you’re not just running simple completions.
How Per-Token Pricing Actually Works
Every major AI provider charges for language models based on tokens — the units of text that models process and generate. A token is roughly four characters of English text, or about three-quarters of a word. “Hello, how are you?” is approximately five tokens.
Pricing is split into two buckets:
- Input tokens: Everything you send to the model — the system prompt, conversation history, tool definitions, retrieved documents, user messages.
- Output tokens: Everything the model generates back — its response, reasoning traces, tool call parameters, and any structured data it produces.
Output tokens typically cost three to five times more than input tokens, which matters a lot in practice.
Here’s where Claude pricing currently sits for context:
| Model | Input (per 1M tokens) | Output (per 1M tokens) |
|---|---|---|
| Claude Opus 4 | ~$15 | ~$75 |
| Claude Sonnet 4 / Sonnet 5 | ~$3 | ~$15 |
Sonnet is roughly five times cheaper per token. If you’re building a simple chatbot or single-turn summarization tool, that’s a meaningful cost advantage.
But “per token” pricing only tells you the rate. The actual cost depends on how many tokens a workflow consumes — and that’s where agents break the intuition.
What Changes in Agentic Workflows
A traditional AI call is a round trip: you send a prompt, you get a response, you’re done. Token count is predictable and bounded by the size of your input and the length of the expected output.
Agents work differently. An agent is a system that loops — it receives a task, reasons about what to do, takes an action (like calling a tool, searching the web, or writing a file), receives the result, then reasons again based on that result, and continues until the task is complete.
Every loop iteration adds tokens to the context. Tool call results, intermediate reasoning steps, previous conversation turns — all of it accumulates. In a complex multi-step workflow, a single task might involve dozens of loop iterations before completion.
This changes the cost equation in a few specific ways.
Context Accumulates Across Steps
Most LLMs process the full conversation context on every API call. That means by the time your agent is on step 10 of a workflow, it’s sending the entire history of steps 1 through 9 as input tokens — every turn, every tool result, every prior reasoning trace.
A 10-step agent workflow doesn’t cost 10× a single call. It can cost 55× (the sum of 1 + 2 + 3 + … + 10) because each successive call has a larger input context.
Extended Thinking Multiplies Output Tokens
Claude Sonnet 5 supports extended thinking — a mode where the model generates an internal chain-of-thought reasoning trace before producing its final answer. This reasoning is often longer than the visible output itself, sometimes significantly so.
Extended thinking is one of the main reasons Sonnet 5 outperforms Opus on complex reasoning tasks. But that thinking is billed as output tokens. On a hard problem, a model might generate 2,000–5,000 tokens of internal reasoning to produce a 300-token answer.
If you’re running a workflow where the model reasons carefully at each step, those thinking tokens compound fast.
Tool Definitions Sit in Every Prompt
When an agent has access to tools — search, code execution, database queries, API calls — the schema for each tool gets sent as part of the system prompt on every API call. A well-equipped agent with 15–20 tools might have 3,000–5,000 tokens of tool definitions sitting in every single request.
If you’re making 50 API calls in a workflow, you’re paying for those tool definitions 50 times.
Multi-Agent Architectures Multiply Everything
Seven tools to build an app. Or just Remy.
Editor, preview, AI agents, deploy — all in one tab. Nothing to install.
Orchestrator-worker patterns — where a manager agent delegates subtasks to specialized subagents — compound all of the above. Each subagent has its own context, its own tool definitions, its own reasoning loops. A workflow that looks like “one agent doing a task” might actually be 4–6 model calls per logical step, each with its own token overhead.
The Real Cost Calculation
Let’s make this concrete with a worked example.
Imagine a research agent that takes a business question, searches the web across multiple queries, synthesizes findings, and produces a structured report. Here’s a simplified breakdown of what it might consume:
System prompt + tool definitions: 4,000 tokens (sent every call) Each search result injected into context: ~1,500 tokens Model’s reasoning per step (extended thinking): ~3,000 tokens Number of search-and-reason loops: 8 Final synthesis output: ~2,000 tokens
Let’s estimate the total token load. In each loop iteration, the input includes the growing conversation history. By the middle of the workflow, each call is sending 15,000–20,000 input tokens. Output tokens across 8 reasoning loops plus the final answer might total 26,000+ tokens.
Rough total for this workflow:
- Input: ~120,000 tokens
- Output: ~26,000 tokens
Cost at Sonnet 5 rates ($3 / $15 per million):
- Input: $0.36
- Output: $0.39
- Total: ~$0.75
Now imagine the same workflow with Claude Opus 4, but because Opus is more efficient at reasoning, it completes the task in fewer steps — 5 loops instead of 8, with shorter thinking traces:
- Input: ~60,000 tokens
- Output: ~14,000 tokens
Cost at Opus 4 rates ($15 / $75 per million):
- Input: $0.90
- Output: $1.05
- Total: ~$1.95
In this scenario Opus is more expensive. But now flip the assumption: what if Sonnet 5’s extended thinking is more verbose, and the workflow actually takes 12 loops instead of 8?
- Input: ~200,000 tokens
- Output: ~40,000 tokens
Sonnet 5 revised total: ~$1.20
The gap narrows significantly. Add another 4 loops and it closes entirely.
The point isn’t a precise number — it’s that per-token rate is only one input to the cost function. Token volume is the other, and it’s driven by model behavior, workflow structure, and task complexity in ways that aren’t visible from the pricing page alone.
Five Factors That Drive Token Volume Up
If you’re trying to predict or control AI costs in agentic systems, these are the variables that actually matter.
1. Workflow Complexity and Loop Count
More steps = more accumulated context. Every additional loop iteration adds input tokens geometrically, not linearly. Short, well-scoped tasks are dramatically cheaper than open-ended exploratory ones.
2. Extended Thinking Settings
Most providers let you cap the thinking token budget. If you set thinking_tokens: 10000, the model will use up to 10,000 tokens for internal reasoning. Setting this lower reduces costs but may reduce answer quality on hard problems. The right setting depends on what the task actually needs.
3. Context Window Management
Sophisticated agent frameworks implement context compression — summarizing older conversation turns rather than sending the full raw history. This can reduce input token costs by 40–70% on long workflows. Without it, costs scale poorly.
4. System Prompt Size
Remy is new. The platform isn't.
Remy is the latest expression of years of platform work. Not a hastily wrapped LLM.
A bloated system prompt sent on every call is dead weight. A 5,000-token system prompt on 50 API calls costs $0.75 at Sonnet 5 rates before the model has processed a single word of actual content. Trim system prompts to what’s genuinely needed.
5. Tool Result Size
Tool outputs get injected directly into context. A web search tool that returns full page content rather than a summarized extract might inject 3,000 tokens per result. Filtering and truncating tool results before they hit the context is one of the highest-leverage cost controls available.
Model Selection: A Framework for Agentic Use Cases
Given all this, how should you actually choose between models for agentic workflows? Here’s a practical decision framework.
Benchmark on Your Actual Task
Per-token pricing comparisons are useful for ballpark estimates. What you actually need is a cost-per-successful-completion benchmark on your specific task. Run 20–50 representative examples through each candidate model, measure total input and output tokens consumed, calculate the dollar cost, and measure task success rate.
The model that completes tasks in fewer steps, with fewer errors (which cause costly retries), may be cheaper overall even at a higher per-token rate.
Consider the Cost of Failure
A cheaper model that fails 15% of the time costs more than a premium model with a 3% failure rate — because failures trigger retries, which double the token cost of those tasks. For high-volume workflows, quality differences matter a lot to the final cost.
Match Thinking Budget to Task Difficulty
Not every step in an agentic workflow requires heavy reasoning. A simple API call or data formatting step doesn’t need extended thinking. Routing easy subtasks to faster, cheaper models (or disabling extended thinking for those steps) while reserving deep reasoning for genuinely complex steps is a standard optimization pattern in production agent systems.
Profile Before Optimizing
Most teams discover their token costs are dominated by a small number of steps — usually the first reasoning call (large system prompt + tool definitions) and the final synthesis (long accumulated context). Profiling your actual token usage step-by-step is far more valuable than trying to optimize in the abstract.
Where MindStudio Fits Into This
When you’re building agents that run across multiple steps, manage context, and call external tools, the infrastructure decisions underneath that system directly affect what you pay.
MindStudio’s visual agent builder lets you work with 200+ models — including Claude Sonnet 5, Claude Opus, GPT-4o, Gemini, and many others — and switch between them at the workflow level or even the step level. That means you can route different parts of a workflow to different models based on what they actually need.
A research agent built in MindStudio might use a lightweight model for initial query generation, Sonnet 5 with extended thinking for the core synthesis step, and a fast cheap model for formatting the final output. Each step uses the model appropriate to the task — not the same model for everything.
Because MindStudio handles the API layer, you don’t need to manually track token limits, handle rate limiting, or manage context stitching between steps. The platform also shows you which models you’re using across workflows, which helps identify where token costs are concentrating.
The other thing that matters: you can test model choices quickly. Since the average workflow build in MindStudio takes 15 minutes to an hour, you can actually run the benchmark — build the workflow, test it with Sonnet 5 and Opus, compare outputs and costs, and make a real decision rather than guessing from a pricing table.
You can try it free at mindstudio.ai.
Common Mistakes That Inflate Costs
These show up constantly in production agentic systems.
Using one model for everything. A single capable model for every step sounds simple but is almost always suboptimal on cost. Routing easy steps to cheaper models can cut costs 30–60% with no quality loss.
Uncontrolled context growth. Letting context accumulate without compression or truncation causes costs to scale quadratically with workflow length. Implement context summarization for workflows that run more than 8–10 steps.
Overly large system prompts. Packing everything you might ever need into the system prompt is tempting. But every token in that prompt is paid for on every API call. Keep system prompts lean and inject instructions dynamically when needed.
No ceiling on thinking tokens. If you’re using a model with extended thinking and you haven’t set a thinking budget limit, you’re exposed to variable costs that can spike significantly on complex inputs. Set an explicit ceiling appropriate to the task.
Skipping failure analysis. Teams focus on cost per call but don’t track cost per successful completion. A workflow with a high retry rate might look cheap per call while being expensive per completed task.
Frequently Asked Questions
Is Claude Sonnet 5 better than Opus for most tasks?
On many benchmarks, yes. Claude Sonnet 5 with extended thinking matches or exceeds Opus on reasoning-heavy tasks while costing significantly less per token. For straightforward tasks — summarization, classification, extraction, generation — Sonnet 5 is typically the better choice. Opus still has an edge in some nuanced long-context reasoning scenarios, but the gap has narrowed substantially. The practical question is which model performs better on your specific task, at your specific token volume.
Why does extended thinking increase costs so much?
Extended thinking works by having the model generate a scratchpad — an internal monologue where it works through the problem before producing the final answer. This scratchpad is generated token by token, just like any other output, and is billed as output tokens. On hard problems, the thinking trace can be many times longer than the visible answer. The benefit is more accurate, better-reasoned responses. The tradeoff is higher token cost. Whether it’s worth it depends on how much accuracy matters for the task.
How do I estimate AI model costs before building a workflow?
Start with a small sample: run 10–20 representative tasks manually and log the token counts from the API responses. Most providers return token usage in the API response. Calculate the average input and output tokens per task, multiply by the relevant per-million price, and scale to your expected volume. Add a 30–50% buffer for edge cases, retries, and tasks that take more steps than average. This rough model is usually more accurate than any pricing calculator because it captures the actual behavior of your workflow, not a hypothetical one.
Can you mix models within a single workflow?
Plans first. Then code.
Remy writes the spec, manages the build, and ships the app.
Yes, and it’s increasingly standard practice in production agent systems. Different steps in a workflow have different requirements — some need heavy reasoning, others just need fast formatting or classification. Using a premium model only where it’s genuinely needed, and routing everything else to a cheaper model, is one of the most effective cost optimizations available. Platforms like MindStudio and frameworks like LangGraph support per-step model selection natively.
Does context window size affect pricing?
Context window size refers to how much text a model can process in a single call — it’s a capability limit, not a direct cost driver. But using more of the available context window does mean higher input token costs. A 200k context window model doesn’t cost more per token just for having a large window, but if you’re filling 150,000 tokens of that window with accumulated context on every call, you’re paying for all of it.
What’s the cheapest way to run Claude in a production agent?
A few practices combined make the biggest difference: implement context compression (summarize old turns rather than passing raw history), set a thinking token budget ceiling on extended thinking, trim tool definitions to only what’s needed for each step, filter and truncate tool outputs before they hit the context, and route simpler steps to smaller models. Anthropic’s documentation on cost optimization also covers prompt caching, which can significantly reduce costs for workflows with large repeated system prompts.
Key Takeaways
- Per-token pricing is the rate, not the cost. Total cost depends on token volume, which agentic workflows can multiply dramatically compared to single-turn calls.
- Extended thinking increases output tokens significantly. This is the primary driver of cases where Sonnet 5 ends up more expensive than Opus — more reasoning steps, larger thinking traces.
- Context accumulates geometrically. Each step in an agent loop adds to the input context of all subsequent steps. Long workflows compound costs fast without context management.
- Benchmark on your actual task. A model’s pricing page tells you the rate; only running your workflow tells you the real cost.
- Mix models within workflows. Routing different steps to the appropriate model — not defaulting to one model for everything — is the highest-leverage cost optimization for most production agents.
- Failure rate matters as much as per-call cost. A cheaper model with a higher failure rate often costs more per successful completion than a premium model that gets it right the first time.
The smartest AI infrastructure decisions don’t come from staring at pricing tables. They come from profiling real workflows, measuring actual token consumption, and making model selections based on cost-per-outcome — not cost-per-token.
