Skip to content
·10 min read

OpenAI API Pricing in 2026 vs Anthropic vs Google

Real pricing breakdowns for OpenAI, Anthropic, and Google so your AI features do not blow your budget

Share

AI API pricing in 2026 ranges from $0.15 per million tokens (Google Gemini Flash) to $15 per million tokens (Claude Sonnet output), a 100x spread that determines whether your AI feature costs $4.50 per month or $450. This guide breaks down every major model's pricing and gives you a framework to keep your bill predictable.

I track my AI API spend across three products every month. My combined bill last month was $127. Six months ago, before I implemented the cost controls in this article, it was $340 for the same traffic. The difference is not fewer features. It is smarter model selection and caching.

The 2026 Price Sheet

Here is what every major AI API actually costs right now, per million tokens. These are standard (non-batch, non-cached) rates as of early 2026.

ModelInput (per 1M tokens)Output (per 1M tokens)Context Window
GPT-4o$2.50$10.00128K
GPT-4.1$2.00$8.001M
Claude Sonnet 4$3.00$15.00200K
Claude Haiku 4$0.80$4.00200K
Gemini 2.5 Pro$1.25$10.001M
Gemini 2.5 Flash$0.15$0.601M

The pattern is clear. Output tokens cost 3x to 5x more than input tokens across every provider. Most developers focus on prompt length (input) while ignoring that the model's response (output) is the expensive part. A chatbot generating 500-word responses costs far more than one generating 50-word answers, even with identical prompts.

Google's Gemini 2.5 Flash is the cheapest option by a wide margin, roughly 5% of what Claude Sonnet charges. If your use case tolerates slightly lower quality (summarization, classification, simple extraction), Flash saves you 90% or more.

Key Takeaway

Output tokens are the real cost driver, not input tokens. A typical API call uses 500 to 2,000 tokens of output. At Claude Sonnet 4 rates, 2,000 output tokens cost $0.03 per request. The same output from Gemini 2.5 Flash costs $0.0012. Choosing the right model for each task is the single highest-leverage cost decision you will make.

What actually matters is how these numbers translate to real monthly bills. The per-million-token pricing feels abstract until you multiply it by actual usage patterns.

What 1,000 Daily Users Actually Costs

A typical AI-powered feature (chatbot, summarizer, content generator) uses 500 to 2,000 tokens per request. Let's use 1,000 tokens of input and 1,000 tokens of output per request as a realistic middle ground. At 1,000 daily active users making 5 requests each, that is 5,000 requests per day, or roughly 150,000 requests per month.

Here is what that costs per month on each model.

ModelMonthly Input CostMonthly Output CostTotal Monthly Cost
GPT-4o$0.38$1.50$1.88
GPT-4.1$0.30$1.20$1.50
Claude Sonnet 4$0.45$2.25$2.70
Claude Haiku 4$0.12$0.60$0.72
Gemini 2.5 Pro$0.19$1.50$1.69
Gemini 2.5 Flash$0.02$0.09$0.11

At 1,000 daily users, even Claude Sonnet runs under $3 per month. The problem is that usage rarely stays at 1,000 users making 5 short requests. Prompts get longer, responses get longer, and power users make 20 or 30 requests per session. Here is what happens as you scale.

Daily Active UsersRequests/DayClaude Sonnet 4GPT-4oGemini Flash
100500$0.27$0.19$0.01
1,0005,000$2.70$1.88$0.11
5,00025,000$13.50$9.38$0.56
10,00050,000$27.00$18.75$1.13
50,000250,000$135.00$93.75$5.63

At 50,000 DAU, Claude Sonnet at $135 per month versus Gemini Flash at $5.63 is a 24x difference. For a bootstrapped product, that gap determines profitability.

EXPLAINER DIAGRAM: A line chart with five lines representing monthly AI API cost on the Y-axis (from $0 to $150) and daily active users on the X-axis (from 100 to 50,000 on a logarithmic scale). The Claude Sonnet 4 line is the steepest, climbing to $135 at 50K DAU. GPT-4o is slightly below it at $94. Claude Haiku 4 runs in the middle at about $36. Gemini 2.5 Pro is just below Haiku. Gemini 2.5 Flash is nearly flat along the bottom at $5.63. A shaded zone between $0 and $20 is labeled INDIE HACKER COMFORT ZONE. Each line is color-coded and labeled at its endpoint.
Gemini Flash stays nearly flat while Claude Sonnet climbs steeply. Model routing lets you use the expensive model only when quality demands it.

These projections assume uniform 1,000-token requests. Real-world usage is spikier; a coding assistant might average 3,000 output tokens per request, and a document summarizer processing PDFs might use 15,000 input tokens per call. Always benchmark actual token usage before budgeting.

The $607 Replit Bill and Why It Happens

A developer posted a $607 Replit bill that went viral. The root cause: unmonitored AI agent usage with no spending cap. The AI assistant kept running and kept generating charges while the developer assumed everything was within normal limits.

This happens on every platform. You build a feature, test it with 10 requests, estimate a comfortable monthly cost, then deploy without a hard spending limit. Then one of three things goes wrong.

First, a retry loop. Your code catches an API error, retries automatically, gets the same error, and retries again. Without exponential backoff, one failed request becomes a thousand. Second, a power user makes 500 requests in an afternoon instead of your estimated 5. Third, someone abuses your AI feature to run complex multi-step tasks through your API key.

Building AI Features Into Your Product?

Get the cost structure right before your first user hits the API.

See all guides

Every one of these scenarios is preventable. Anthropic, OpenAI, and Google all support monthly spending caps in their dashboards. Set yours to 150% of your expected monthly cost. If you project $20, cap it at $30. A temporarily unavailable feature is better than a $607 bill.

Four Ways to Cut Your AI API Bill in Half

Cost optimization for AI APIs is not about using AI less. It is about using it smarter. Here are four techniques ranked by impact.

1. Model routing. Not every request needs your best model. Route easy tasks (classification, extraction, formatting) to Gemini Flash or Claude Haiku and reserve frontier models for complex reasoning. In my own apps, 70% of requests go to the cheap model. This alone cut my bill by 55%. A basic if/else on task type works surprisingly well.

2. Response caching. If the same question gets the same answer, cache it. A Redis or in-memory cache with a 24-hour TTL eliminates duplicate API calls completely. Caching handles 30% to 40% of requests for a typical chatbot, especially FAQ bots and search-like features.

3. Prompt compression. Most prompts contain redundant context. Cutting a 2,000-token system prompt to 800 tokens saves 60% on input costs for every request. Multiply that by 150,000 monthly requests and the savings add up fast. Review prompts quarterly; they accumulate unnecessary instructions over time.

4. Batch processing. For background jobs and non-real-time tasks, use batch APIs. OpenAI and Anthropic both offer 50% discounts on batch requests. A nightly summarization job processing 1,000 documents costs half as much through the batch endpoint.

Common Mistake

Running every request through your most expensive model because "quality matters." Quality matters for user-facing creative tasks and complex reasoning. It does not matter for classification, extraction, or simple formatting. Routing 70% of requests to a model that costs 10x less has almost no impact on user experience but cuts your total API bill by more than half.

Together, these four techniques reduce effective API spend by 70% to 80% compared to naively sending every request to a frontier model.

Building Your Monthly AI Budget

Here is the four-step framework I use to set a monthly AI API budget for any new feature.

EXPLAINER DIAGRAM: A four-step horizontal workflow on a light background. Step 1 labeled MEASURE shows a magnifying glass icon over a code snippet, with text reading Benchmark 100 real requests and record average input and output tokens. Step 2 labeled MULTIPLY shows a calculator icon with text reading Multiply average tokens by projected monthly requests at your user scale. Step 3 labeled MODEL shows three boxes representing different AI models with price tags, with text reading Pick the cheapest model that meets your quality bar for each task type. Step 4 labeled MONITOR shows a dashboard with a spending graph and an alert bell icon, with text reading Set a hard spending cap at 150 percent of projected cost and check weekly. An arrow connects all four steps left to right.
Measure, multiply, model-select, monitor. This four-step framework prevents every AI API budget surprise.

Step 1: Measure. Run 100 representative requests and record the average input and output token counts. Do not guess; actual token counts are usually 2x to 3x what developers estimate.

Step 2: Multiply. Average tokens per request, times projected daily requests, times 30. Use conservative projections for the first three months and optimistic for month six.

Step 3: Model-select. Test your feature on frontier, mid-range, and budget models. For most features, the mid-range option delivers 90% of the quality at 30% to 50% of the cost.

Step 4: Monitor. Set your spending cap, check weekly, and adjust. Below 50% of your cap means you overestimated. Above 80% means optimize or raise the cap.

Claude Code and Development-Time Costs

One cost that catches developers off guard is not production usage at all. It is development-time AI tools. Claude Code, Cursor, and similar assistants run on usage-based pricing. Active developers report spending $50 to $200 per month on Claude Code alone, and 92% of US developers now use AI tools daily.

If you are a solo developer spending $100 per month on Claude Code and $50 on production APIs, your assistant costs more than your infrastructure. That is fine if the productivity gains justify it, but it needs to be in your budget, not a surprise on your credit card. Track development-time costs separately from production costs. They scale differently: development stays flat regardless of user count, while production scales linearly with traffic.

What This Means For You

  • If you are a founder: AI API costs are predictable and controllable. Budget $20 to $50 per month for your first 1,000 users, implement model routing from day one, and set hard spending caps on every API account. If your AI feature helps convert or retain even 1% more users, the API cost pays for itself many times over.
  • If you are an indie hacker: Keep your AI API bill under $20 per month by defaulting to Gemini Flash or Claude Haiku for most tasks and reserving expensive models for the 10% of requests that genuinely need them. Caching and prompt compression are free to implement and cut costs immediately. Your target is profitability, not perfection.
  • If you are a student or career changer: Start with free tiers. Google offers generous free quotas for Gemini, and both OpenAI and Anthropic provide starter credits. Build your projects on budget models first, learn to optimize costs as a skill (employers value this), and only reach for expensive models when you can articulate exactly why the cheaper option is not sufficient.
Ready to Build With AI APIs?

Understand the full cost picture before you start, from hosting to API bills.

Explore cost guides
PJ
Pranay Joshi

20+ years building products at scale. VP of Product & Engineering, startup founder, and AI coach. Helping dreamers turn ideas into reality with vibe coding.

The Tuesday Shipping Report

Every Tuesday, one focused email:

  • - The tool or technique that's actually working right now
  • - A real problem from the community (and how to solve it)
  • - What changed this week in the vibe coding landscape

Read by 1,000+ founders, developers, and creators building with AI. Free forever. No spam.