Quick answer: Running an AI agent costs $0.001–$8+ per task depending on the model, task complexity, and number of agent loop iterations. The hidden multiplier is quadratic token growth — each turn re-sends the full context, so a 10-turn session costs ~50x a single call, not 10x.
Everyone wants to know what AI agents cost before they commit. The problem? Most pricing pages show per-token rates — not what you'll actually pay when an agent runs a 15-step workflow, calls 6 tools, and re-reads its entire context on every turn. And whether you run agents locally or in the cloud changes the cost equation dramatically.
This guide breaks down real-world AI agent costs across every major LLM provider in 2026, explains the token economics that make agent costs behave differently from simple API calls, and gives you proven tactics to cut spending by 60–80%.
A single API call costs fractions of a cent. But agents make dozens of calls per task, and each call re-sends growing context. Understanding this compound effect is the difference between a $50/month bill and a $5,000/month surprise.
LLM API Pricing in 2026: The Complete Comparison
AI agent costs start with the model you choose. Here's what every major provider charges per million tokens (as of March 2026):
| Provider / Model | Input (per 1M) | Output (per 1M) | Context Window |
|---|---|---|---|
| GPT-4.1 | $2.00 | $8.00 | 1M tokens |
| GPT-4o | $2.50 | $10.00 | 128K tokens |
| GPT-4.1 mini | $0.40 | $1.60 | 1M tokens |
| GPT-4o mini | $0.15 | $0.60 | 128K tokens |
| o3 (reasoning) | $2.00 | $8.00 | 200K tokens |
| o4-mini (reasoning) | $1.10 | $4.40 | 200K tokens |
| Claude Opus 4.5 | $5.00 | $25.00 | 200K tokens |
| Claude Sonnet 4.5 | $3.00 | $15.00 | 200K tokens |
| Claude Haiku 4.5 | $1.00 | $5.00 | 200K tokens |
| Gemini 2.5 Pro | $1.25 | $10.00 | 1M tokens |
| Gemini 2.5 Flash | $0.30 | $2.50 | 1M tokens |
| DeepSeek V3 | $0.14 | $0.28 | 128K tokens |
| DeepSeek R1 | $0.55 | $2.19 | 64K tokens |
Key patterns to notice:
- Output tokens cost 3–5x more than input tokens across every provider
- DeepSeek V3 is 18x cheaper than GPT-4o for input tokens — but with trade-offs in reliability and speed. Model routing helps you use the right model for each task automatically
- Prices are falling fast — OpenAI's o3 dropped 80% within months of launch; Claude Opus went from $15/$75 to $5/$25
- Batch APIs offer 50% discounts from OpenAI, Anthropic, and Google for async workloads
Prices jump at higher token counts. OpenAI charges 2x input / 1.5x output above 272K tokens. Anthropic applies premium rates above 200K. Budget for this if your agent processes large documents.
What AI Agents Actually Cost Per Task
Raw token prices don't tell you what you'll pay per task. Here's what real-world agents cost in practice:
Simple Chatbot (Per Conversation)
A typical customer-facing chatbot handles 3–5 turns with 2,000–5,000 total tokens.
| Model | Cost Per Conversation |
|---|---|
| GPT-4o mini | $0.001–$0.003 |
| Gemini 2.5 Flash | $0.005–$0.01 |
| Claude Haiku 4.5 | $0.01–$0.03 |
| Claude Sonnet 4.5 | $0.03–$0.08 |
At this tier, model costs are almost negligible. Even premium models cost under $0.10 per conversation.
AI Coding Agent (Per Task)
Coding agents are far more expensive because they run multi-step reasoning loops, read files, execute code, and re-read their entire context on every turn.
| Agent / Model | Cost Per Task |
|---|---|
| Claude Code (Sonnet) | $0.50–$5.00 |
| Claude Code (Opus) | $2.00–$8.00+ |
| Devin (per ACU) | $2.00–$2.25 per 15-min unit |
| GitHub Copilot | $10–$39/month subscription |
| Cursor | $20/month + overages |
Anthropic reports that Claude Code costs approximately $6/developer/day on average. But individual complex tasks — refactoring across multiple files, debugging production issues — can easily reach $8+.
Claude Code uses 5.5x fewer tokens than Cursor for identical tasks in benchmarks (33K vs. 188K tokens). The cheapest model isn't always the cheapest agent — token efficiency determines your actual bill.
Customer Support Agent (Per Ticket)
| Approach | Cost Per Ticket |
|---|---|
| AI agent (API cost only) | $0.02–$0.50 |
| AI agent (platform pricing) | $1–$6 |
| Human agent (industry benchmark) | $5–$25 |
AI-powered support platforms like Crescendo.ai charge around $1.25 per resolution. Raw API costs are far lower — but you're paying for orchestration, guardrails, and escalation logic on top.
The ROI is clear: AI agents handle 25–45% of ticket volume, with 2–5x return on investment in the first year for most deployments.
Data Processing Agent (Per Document)
| Task | Cost Per Document |
|---|---|
| 10-page PDF extraction (GPT-4o) | $0.01–$0.08 |
| RAG query (chunk + embed + retrieve + generate) | $0.05–$0.50 |
| 1,000 documents/day pipeline | $50–$500/day |
Token Economics: Why Agent Costs Grow Quadratically
This is the most important concept in AI agent cost management, and the one most teams learn the hard way.
The Quadratic Token Trap
A simple API call is linear: you send a prompt, get a response, done. But agents run in loops. On each turn, the agent re-sends the entire conversation history — system prompt, all previous messages, tool outputs, everything.
Here's how the math works for a 10-turn agent session:
| Turn | New Tokens | Cumulative Context Sent | Running Total |
|---|---|---|---|
| 1 | 500 | 500 | 500 |
| 2 | 500 | 1,000 | 1,500 |
| 3 | 500 | 1,500 | 3,000 |
| 5 | 500 | 2,500 | 7,500 |
| 10 | 500 | 5,000 | 27,500 |
A 10-turn session consumes 27,500 tokens total — not 5,000. That's 5.5x what most people expect. For longer sessions with tool outputs (which add thousands of tokens per call), the multiplier gets worse.
PostHog documented this exact problem: "Cumulative input tokens cost increases quadratically for every extra turn." Their AI agent was "embezzling tokens" — running up costs through loops that looked linear but grew quadratically.
For an initial prompt of N tokens and K new tokens per turn over T turns, total input tokens ≈ N×T + K×T×(T+1)/2. This is O(T²) growth — and it's why a 50-turn coding session can cost 100x what you'd expect from per-token pricing.
Input vs. Output Token Economics
Claude Code reports that 99.4% of its token usage is input tokens — because every turn re-reads the entire context. This completely inverts the pricing model: even though output tokens cost 3–5x more per token, it's the input token volume that dominates your bill.
This means:
- Reducing context size has a bigger impact than reducing output length
- Prompt caching (which discounts input tokens) is the single highest-leverage cost optimization
- Model routing is most effective when routing by context length, not just task complexity
Tool Calling Overhead
Every tool your agent can access adds tokens to every request — the tool's schema, description, and parameter definitions are sent as part of the prompt on each turn. An agent with 30 tools defined burns thousands of tokens per turn just on tool definitions, even if it only uses 2.
Tool outputs compound the problem: each tool response gets appended to the conversation history and re-sent on all subsequent turns. A single file-read tool call that returns 2,000 tokens of content will cost you 2,000 tokens on every subsequent turn for the rest of the session.
5 Proven Tactics to Cut AI Agent Costs by 60–80%
1. Use Prompt Caching
Prompt caching is the single most impactful optimization. Providers discount cached input tokens — the system prompt, tool definitions, and other content that stays identical between turns.
| Provider | Cache Discount | How It Works |
|---|---|---|
| Anthropic | 90% on reads | Cache writes cost +25%, but reads are 90% off. Automatic for system prompts. |
| OpenAI | 50% on reads | Automatic caching, no explicit opt-in needed. |
| DeepSeek | 90% on reads | Zero-config caching on cache hits. |
Real-world impact: One developer reduced monthly costs from $720 to $72 — a 90% savings — by enabling prompt caching alone.
For agents, this matters enormously. Your 10K-token system prompt gets re-sent on every turn of a 50-turn session. Without caching, that's 500K redundant tokens. With Anthropic's caching, those reads cost 90% less.
2. Route Models by Task Complexity
Not every agent step needs your most powerful model. Route simple tasks to cheap models and reserve expensive ones for complex reasoning.
| Task Type | Recommended Model | Cost per 1M Input |
|---|---|---|
| Classification, extraction, formatting | GPT-4o mini / Haiku | $0.15–$1.00 |
| Standard generation, summarization | Sonnet / GPT-4.1 | $2.00–$3.00 |
| Complex reasoning, planning, coding | Opus / o3 | $2.00–$5.00 |
Implementation: use a lightweight classifier (often the cheap model itself) to score task complexity, then route accordingly. Teams report 30–50% overall cost reduction from model routing alone.
3. Manage Your Context Window
The quadratic cost trap is driven by growing context. Fight it with these techniques:
- Rolling summarization — compress turns older than N into a 200–400 token summary. Typical savings: 50–70% token reduction with no measurable performance loss.
- Trim tool outputs — don't keep raw file contents in conversation history. Summarize or discard tool outputs after the agent has processed them.
- Dynamic tool loading — expose only the tools relevant to the current task phase. An agent given 30 tools when it needs 3 wastes thousands of tokens per turn on unused definitions.
For more on these techniques, see our guide to context engineering for AI agents.
4. Batch Non-Urgent Workloads
All three major providers offer ~50% discounts for batch (asynchronous) processing:
| Provider | Batch Discount | Turnaround |
|---|---|---|
| OpenAI | 50% | Up to 24 hours |
| Anthropic | 50% | Up to 24 hours |
| Google (Gemini) | 50% | Up to 24 hours |
If your agent processes documents, generates reports, or handles tasks without real-time latency requirements, batch processing cuts your bill in half with no quality trade-off.
5. Consider Self-Hosting at Scale
At high volume, self-hosting open-source models becomes economically viable.
| Approach | Cost per 1M Tokens | Break-Even Point |
|---|---|---|
| Llama 3 70B via API (Together AI) | $0.70–$0.90 | N/A |
| Llama 3 70B self-hosted (2x A100) | ~$0.07 | ~70M tokens/day |
| DeepSeek V3 direct API | $0.14 | N/A |
Self-hosting makes sense when you process 70M+ tokens/day for 70B-class models. Below that, API pricing wins on flexibility and total cost of ownership (no GPU management, no infrastructure team).
AI Agent Cost Calculator: Quick Reference
Use this to estimate your monthly spend:
| Agent Type | Tasks/Day | Tokens/Task | Model | Monthly Cost |
|---|---|---|---|---|
| Customer support bot | 500 | 5,000 | GPT-4o mini | ~$12 |
| Customer support bot | 500 | 5,000 | Claude Sonnet | ~$135 |
| Coding agent | 50 | 100,000 | Claude Sonnet | ~$270 |
| Coding agent | 50 | 100,000 | Claude Opus | ~$450 |
| Document processor | 1,000 | 10,000 | Gemini 2.5 Flash | ~$84 |
| RAG research agent | 200 | 50,000 | GPT-4.1 | ~$300 |
These estimates assume no caching or batching. Apply prompt caching for 50–90% reduction on input-heavy workloads.
Combine all five tactics and the savings compound: prompt caching (50–90%) + model routing (30–50%) + context management (50–70%) + batching (50%). Teams that implement the full stack routinely achieve 60–80% total cost reduction vs. naive usage.
Hidden Costs Most Teams Miss
Beyond API tokens, watch for these often-overlooked expenses:
-
Retry loops — when an agent fails and retries, it re-sends the full context. A single retry doubles the cost of that turn. Implement fail-fast logic with circuit breakers.
-
Monitoring infrastructure — you need observability to catch runaway agents. Tools like LangSmith, Helicone, or custom dashboards add $50–$500/month.
-
Embedding costs — RAG pipelines require embedding documents before retrieval. OpenAI's
text-embedding-3-smallcosts $0.02/M tokens. At 1M documents, embedding alone is $200+. -
Guardrail overhead — safety layers (content filters, output validators, human-in-the-loop routing) add latency and token costs per request.
-
The "Replit problem" — Replit reported a simple button-color change costing ~$1 because the agent re-read the entire project context. Agents that re-read everything on every action are silently expensive.
AI Agents vs. Human Workers: The Real ROI
The cost comparison that matters most isn't between LLM providers — it's between AI agents and the humans they augment.
| Task | AI Agent Cost | Human Cost | AI Advantage |
|---|---|---|---|
| Customer support ticket | $1–$6 | $5–$25 | 4–5x cheaper |
| Code review | $0.50–$3.00 | $50–$100/hour | 20–50x cheaper |
| Document extraction | $0.01–$0.08 | $1–$5 per page | 50–100x cheaper |
| Meeting summary | $0.05–$0.20 | $15–$30 (manual) | 100x+ cheaper |
The real value isn't replacement — it's leverage. AI agents handle the volume while humans handle the exceptions. A support team of 10 humans + AI agents outperforms a team of 20 humans without them, at lower total cost.
For teams coordinating multiple AI agents across workflows, platforms like cowork.ink handle the orchestration, context management, and cost monitoring — so you get the savings without building the infrastructure from scratch.
What's Next for AI Agent Pricing
Three trends are reshaping AI agent economics in 2026:
-
Prices will keep falling — GPT-4-class models cost 97% less than two years ago. Every major provider is competing on price. Budget models like GPT-4o mini and Gemini Flash make agents viable for use cases that were cost-prohibitive 12 months ago.
-
Per-outcome pricing is emerging — instead of raw token billing, platforms charge per resolution, per document, or per task completed. This shifts risk from the buyer to the provider and makes costs predictable.
-
Context engineering reduces costs more than model improvements — our analysis shows that well-engineered context reduces token usage by 60–80% regardless of model. As AI agent architectures mature, cost optimization shifts from model selection to system design.
Get Started
cowork.ink helps teams deploy AI agents with built-in cost controls — model routing, context management, usage monitoring, and budget guardrails — so you get production-grade agents without production-grade bills.
Start building your first AI agent workflow and see exactly what it costs, in real time.
For more on the technical foundations, see our guides to AI agent architecture, context engineering, and building AI agents without code.