I checked my API dashboard last Tuesday and nearly spat out my coffee. $247. Just for one agent running test loops over the weekend. It wasn’t even doing real work. Just experimenting with tool-calling chains and a Mistral fallback I forgot to turn off.
That’s when I started properly tracking what each model actually costs per agent run. Not the marketing numbers on the pricing page. Real cost. Multi-turn, tool-heavy, long-context, agent-style usage. The results surprised me.
Here’s the thing about AI agents that nobody tells you upfront: they burn through tokens like crazy. A simple chat with Claude uses maybe 500-1000 tokens. An agent run? It chews through 15,000-50,000 tokens per task. System prompts. Tool definitions. Multiple conversation turns. Thinking tokens if you’re using reasoning models. The context window balloons with every function call result that gets appended.
So picking the cheapest model isn’t just about saving a few bucks. At agent scale, model choice is the difference between a $400 monthly bill and a $4,000 one. And honestly? The cheapest model is often not what you think.
The Real Cost of Running an AI Agent
Before I dump a pricing table on you, we need to talk about what actually drives agent costs. It’s not the same as chatbot costs.
Agents hit the API differently. A typical agent task—let’s say “research this topic, summarize the findings, and send an email”—might look like this: 2,000 tokens for the system prompt and tool definitions, 500 for the initial instruction, then 3-5 turns of the model calling tools (another 8,000-15,000 tokens of tool results being fed back in), then a final generation of 800 tokens. That’s roughly 12,000-18,000 total tokens per task. And that’s a simple one.
Complex agents doing multi-step research or code generation can easily hit 50,000-100,000 tokens per run. Run that 50 times a day—not unreasonable for a production agent—and suddenly your model’s per-token price starts mattering a lot.
So I built a cost model. Input-to-output ratio for agents is roughly 3:1 in my testing. Sometimes 4:1 for research-heavy agents. I’m using 3:1 for the rankings below. All prices are per million tokens, current as of July 2026.
Tier 1: The Dirt-Cheap Open-Source Hosted Models
These aren’t frontier models. They’re smaller open-source models hosted by inference providers, and they’re so cheap it’s almost funny. For agent tasks that don’t need PhD-level reasoning—classification, extraction, simple routing, summarization—these crush it.
🥇 Together AI — LFM2 24B: $0.03 input / $0.12 output
This is the cheapest model I’ve found that’s actually usable. Liquid AI’s LFM2 24B on Together AI clocks in at three cents per million input tokens. Three. Cents. At a 3:1 agent ratio, you’re looking at about $0.21 per million effective tokens. For perspective, running 100 agent tasks at 20K tokens each would cost you roughly $0.42 total. You read that right. Forty-two cents.
The catch? It’s a 24B model. It can handle classification routing summarization and basic tool use but don’t expect it to write production code or reason through complex multi-step problems. For that, you’ll want something beefier. But for the boring agent tasks—sorting emails, extracting data from PDFs, routing support tickets—it’s more than enough.
🥈 Groq — Llama 3.1 8B: $0.05 input / $0.08 output
Groq’s hosting of Meta’s Llama 3.1 8B is stupidly fast and stupidly cheap. 840 tokens per second throughput. $0.05 per million input, $0.08 output. The total cost at 3:1 agent ratio? About $0.23 per million tokens. And because Groq’s hardware is purpose-built for inference, you get near-instant responses. For latency-sensitive agent workflows—like real-time customer-facing agents that need to respond in under 2 seconds—this is the budget king.
8B parameters is small though. It’ll do basic tool calling and structured output just fine. Don’t ask it to write a legal document.
🥉 Groq — GPT OSS 20B: $0.075 input / $0.30 output
OpenAI’s open-source 20B model hosted on Groq. Slightly better reasoning than Llama 8B, still dirt cheap. $0.075 input, $0.30 output. At agent ratios, roughly $0.53 per million tokens. Good middle ground between “too dumb to use” and “costs actual money.”
Tier 2: The API Budget Kings
Now we’re in proper frontier-model territory. These are models you’d actually trust with agentic workflows, and they’re priced aggressively.
🥇 DeepSeek V4 Flash: $0.14 input / $0.28 output
This is the one that surprised me. DeepSeek V4 Flash is their fast/cheap tier and it’s absurdly competitive. $0.14 per million input tokens. $0.28 per million output. But here’s the real kicker: prompt caching hits are $0.0028 per million. That’s not a typo. Less than a third of a cent.
For agents, prompt caching is a massive lever. Your system prompt and tool definitions get cached on the first call. Every subsequent turn reuses them at 1/50th the cost. At a typical agent workflow with 80% cache hit rate, the effective input cost drops to around $0.03 per million. Total agent cost lands around $0.34 per million tokens. That’s cheaper than the open-source hosted models for cached workloads.
And the model quality? 1M context window. Tool calling is solid. JSON mode works. It handles complex multi-step reasoning decently. For most agent automation tasks, DeepSeek V4 Flash is the best price-to-performance ratio on the market right now. Not even close.
🥈 GPT-4o-mini (OpenAI): $0.15 input / $0.60 output
OpenAI’s budget workhorse. It’s been around a while and the tool-calling support is battle-tested. $0.15 input, $0.60 output, roughly $1.05 per million at agent ratios. More expensive than DeepSeek Flash by about 3x on effective cost, but you get OpenAI’s ecosystem: structured outputs, parallel tool calls, built-in vision. If your agent stack is already on OpenAI’s API, switching away might not be worth the engineering time even if you’re paying more per token.
🥉 GPT-5.4-nano: $0.20 input / $1.25 output
OpenAI’s newest budget tier. Smarter than 4o-mini, about 30% more expensive. At $1.85 per million agent tokens it’s creeping toward mid-range pricing but the quality bump is noticeable. Decent for agents that need more reasoning but still need to stay lean.
Tier 3: Mid-Range Workhorses
These models can handle serious agent work. They’re where you go when the budget tier isn’t cutting it but you’re not ready to pay Claude Sonnet prices.
DeepSeek V4 Pro: $0.435 input / $0.87 output
The big brother to V4 Flash. Noticeably better at complex reasoning. $1.30 per million agent tokens at 3:1 ratio. With caching, it drops to about $0.90. Still cheaper than GPT-4o-mini without caching. If your agent needs to write code or reason through multi-step problems, this is probably the sweet spot right now.
Gemini 3 Flash Preview (Google): $0.50 input / $3.00 output
Google’s mid-tier offering. Input is cheap, output is expensive. At agent ratios, roughly $4.50 per million. The 1M token context window is a huge advantage for agents that need to process large documents. And it supports multimodal input—text, images, video, audio. If your agent deals with varied media, this is the best value in the multimodal space.
Tier 4: Premium Agent Models
These are the models you use when the agent has to work, and budget is secondary.
Claude Haiku 4.5 (Anthropic): $1 input / $5 output
Anthropic’s fastest and cheapest current model. $8 per million at agent ratios. The tool use is probably the best in the industry—Claude’s function calling is genuinely excellent. Computer use is supported. If your agent needs to interact with browser UIs or do complex multi-tool orchestration, Haiku 4.5 is the cheapest model that does it reliably.
But $8/M is a lot compared to DeepSeek’s $0.34/M. You’re paying roughly 23x more per token. The question is whether the reliability difference is worth it, and for production agents where failure costs real money, the answer is often yes.
Gemini 3.1 Flash-Lite (Google): $0.25 input / $1.50 output
Wait—why is this in the premium tier? Because it’s Google’s “cheapest capable model” and it actually has a 1M context window and multimodal support. At $2.25 per million agent tokens it’s more expensive than DeepSeek Flash but the context window alone might be worth it for document-heavy agents. If you’re processing 200-page PDFs in your agent pipeline, this 1M window means you’re not chopping documents into pieces that lose context.
The Open-Source / Self-Hosted Wildcard
I’d be doing you a disservice if I didn’t mention self-hosting because it changes the math completely. If you’re running 10,000+ agent tasks per day, API costs add up fast even at DeepSeek prices. Renting a GPU instance—say an H100 at $2/hour—and running Llama 3.1 70B or Qwen 2.5 32B locally gives you effectively zero per-token cost after the fixed infrastructure spend.
The trade-off is obvious: you’re now managing infrastructure instead of calling an API. Model updates, scaling, failover, monitoring—it’s all on you. vLLM and Ollama have gotten really good though. And the open-source models keep improving. A self-hosted Qwen3 32B on a rented GPU can handle most agent tasks at a fraction of API costs once you cross the volume threshold.
Rough break-even math: at DeepSeek V4 Flash prices ($0.34/M effective), 10,000 agent tasks per day at 20K tokens each costs about $68/day. An H100 instance at $2/hr costs $48/day. You come out ahead self-hosting at around 7,000 tasks/day, assuming you can match the throughput. Add a second GPU for redundancy and the break-even shifts, but you get the idea.
The Ranking Nobody Asked For But You Need
Here’s the full ranking by effective cost per million tokens at a 3:1 input-to-output agent ratio, cache-unaware (reality: caching makes the top contenders even cheaper):
- Together AI LFM2 24B — ~$0.21/M (ultra-budget, basic agent tasks only)
- Groq Llama 3.1 8B — ~$0.23/M (fastest budget option)
- Groq GPT OSS 20B — ~$0.53/M (budget with slightly better reasoning)
- DeepSeek V4 Flash — ~$0.70/M uncached, ~$0.34/M cached (best overall value)
- GPT-4o-mini — ~$1.05/M (reliable, battle-tested ecosystem)
- Groq Llama 4 Scout — ~$0.67/M (good open-source Mixture-of-Experts option)
- DeepSeek V4 Pro — ~$2.18/M uncached, ~$0.90/M cached (best mid-range)
- GPT-5.4-nano — ~$1.85/M (newest OpenAI budget tier)
- Gemini 3.1 Flash-Lite — ~$2.25/M (cheapest 1M context window)
- Gemini 3 Flash Preview — ~$4.50/M (multimodal, large context)
- Claude Haiku 4.5 — ~$8.00/M (best tool use at this price)
- GPT-5.4-mini — ~$6.75/M (capable but pricier mid-range)
- Gemini 3.5 Flash — ~$13.50/M (strong but expensive)
- Claude Sonnet 5 — ~$24.00/M (premium agent workhorse)
What I Actually Use
I run most of my agent workloads on DeepSeek V4 Flash now. It’s fast enough, smart enough for 80% of tasks, and with caching enabled I’m paying less than half a cent per agent task. The remaining 20%—the complex stuff that needs real reasoning—goes to DeepSeek V4 Pro or Claude Haiku 4.5 depending on whether tool use quality matters more than raw intelligence.
I keep a Groq API key around for Llama 3.1 8B when I need something done at 840 tokens per second and I genuinely don’t care about output quality—think “extract all dates from this 50-page document and format them as ISO 8601.” Pure throughput, zero thinking required.
And I’ve got a cron job that logs my API spend every morning to a spreadsheet. Because $247 surprise bills are something I’d rather not repeat. The spreadsheet takes 5 minutes to check. It’s paid for itself about 40 times over.
Anyway. That’s the state of LLM pricing for agents in mid-2026. The gap between the cheapest and most expensive options is roughly 100x. Pick wrong and you’re burning money. Pick right and you’re running agents for pocket change.