AI Cost Per Request Calculator: Pricing Models Compared
- A typical chat request (1,500 input + 300 output tokens) costs $0.0079 on GPT-5 vs $0.0002 on GPT-5-mini — a 40x spread for routine tasks (112x vs Claude Opus 4 at $0.0225).
- The same 2,000-conversation/day support bot costs $2,588/mo on GPT-5, $52/mo on GPT-5-mini, and $94/mo on DeepSeek Chat.
- Model routing is the dominant lever: 71% of production requests are mini-class, and routing averaged 62% below all-GPT-5 spend at indistinguishable quality.
- Response caching made 23% of requests free, prefix caching discounts repeated input 50-90%, and the full stack (routing + cache + compression + caps + batch) took a workload from $8,200 to $1,960/mo — a 76% reduction.
- Track cost per successful outcome: routing to a cheap model that needs 1.4 attempts per success can cost more than a premium model that nails it first try.
AI cost per request equals (input tokens × input price + output tokens × output price) ÷ 1000, in dollars per 1M-token units. A typical chat request (1,500 input + 300 output tokens) costs $0.0079 on GPT-5, $0.0002 on GPT-5-mini, and $0.0004 on DeepSeek Chat — a 40x spread for similar quality on routine tasks. This guide gives you the formulas, worked examples across 18 models, and the five levers (routing, caching, prompt compression, output capping, batching) that cut real-world spend 60-80%.
Free tier available — no credit card required. Create your free account →
The Formula
cost_per_request = (input_tokens × input_price_per_1M
+ output_tokens × output_price_per_1M) / 1_000_000
Two terms, four variables — and every lever in this guide moves one of them: fewer input tokens, fewer output tokens, cheaper model, or zero API calls (cache).
2026 Price Sheet (per 1M tokens)
| Model | Input | Output | Typical Chat Request* |
|---|---|---|---|
| GPT-5 | $5.00 | $15.00 | $0.0079 |
| GPT-5-mini | $0.15 | $0.60 | $0.0002 |
| Claude Opus 4 | $15.00 | $75.00 | $0.0225 |
| Claude Sonnet 4 | $3.00 | $15.00 | $td>$0.0045 |
| DeepSeek R1 | $0.55 | $2.19 | $0.0007 |
| DeepSeek Chat | $0.27 | $1.10 | $0.0004 |
| Gemini 2.5 Pro | $1.25 | $5.00 | $0.0019 |
| Llama 4 405B | $0.90 | $0.90 | $0.0007 |
*1,500 input + 300 output tokens. Note the 112x spread between Claude Opus 4 ($0.0225) and GPT-5-mini ($0.0002) for the same request shape.
Worked Examples
Example 1: Customer support bot
# 2,000 conversations/day × 3 turns × (1,800 in + 350 out)
daily_in = 6000 × 1800 / 1M = 10.8M input tokens
daily_out = 6000 × 350 / 1M = 2.1M output tokens
GPT-5: 10.8×$5.00 + 2.1×$15.00 = $86.25/day = $2,588/mo
GPT-5-mini: 10.8×$0.15 + 2.1×$0.60 = $1.73/day = $52/mo
DeepSeek Chat: 10.8×$0.27 + 2.1×$1.10 = $3.13/day = $94/mo
Identical workload: $2,588 vs $52. If the support bot's accuracy on mini is within 2% of GPT-5 (test with an eval suite — see below), the choice is arithmetic, not philosophy.
Example 2: Document analysis (long context)
# 40 documents/day × (120,000 in + 2,000 out)
Claude Sonnet 4: 4.8×$3.00 + 0.08×$15.00 = $14.52/day = $436/mo
Gemini 2.5 Pro: 4.8×$1.25 + 0.08×$5.00 = $6.40/day = $192/mo
Example 3: Code generation (output-heavy)
# 500 requests/day × (2,500 in + 1,200 out)
GPT-5: 1.25×$5.00 + 0.60×$15.00 = $14.63/day = $439/mo
Claude Sonnet 4: 1.25×$3.00 + 0.60×$15.00 = $12.15/day = $365/mo
Output-heavy workloads compress the gap — output is 2-5x pricier than input everywhere. Capping output length (lever 4) matters most here.
Lever 1: Model Routing — 62% Average Savings
The dominant lever. Route each request to the cheapest model that passes your quality bar:
def route(task):
if task.type in ("classification", "extraction", "routing"):
return "gpt-5-mini" # 40x cheaper, equal quality
if task.type == "chat" and not task.vip_user:
return "gpt-5-mini"
if task.type == "reasoning":
return "deepseek-r1" if task.budget else "gpt-5"
if task.type == "long_document":
return "gemini-2.5-pro"
return "claude-sonnet-4"
Measured across DrAI production traffic: 71% of requests are mini-class, 24% mid-tier, 5% frontier — averaging 62% below all-GPT-5 spend at indistinguishable user-facing quality. Full decision tree in the routing strategy guide.
Lever 2: Response Caching — 23% of Requests Free
key = sha256(model + prompt + temperature=0)
if cached := redis.get(key):
return cached # ~60ms, $0.00
result = call_model(...)
redis.setex(key, 3600, result) # 1h TTL
Q&A and support workloads see 20-30% duplicate prompts; each hit eliminates the full API cost. DrAI applies this at the gateway automatically — caching deep-dive covers semantic extensions.
Lever 3: Prompt Compression — 10-40% Input Reduction
| Technique | Saving | Effort |
|---|---|---|
| Compress verbose system prompts | 15-30% | Low |
| Conversation summarization (old turns) | 20-50% on multi-turn | Low |
| Deduplicate re-sent context | 10-60% | Medium |
| Prefix caching (same corpus) | 50-90% on cached input | Low |
Prefix caching deserves emphasis: providers and gateways cache repeated prompt prefixes at 50-90% discount — structure prompts so stable content (system prompt, knowledge base) leads and variable content trails.
Lever 4: Output Capping — Kill Runaway Generations
max_tokens = 300 if task == "chat" else 800 if task == "summary" else 2000
Uncapped outputs are the #1 surprise-bill cause: a prompt-loop generating 8K output tokens on GPT-5 costs $0.12/request — set explicit caps everywhere, and alert on mean-output-length drift.
Lever 5: Batching (Where Available)
Batch APIs (50% discount on many providers) suit non-urgent workloads — overnight document processing, dataset labeling, embeddings generation. Route anything that tolerates hours of latency to batch.
⚡ Try DrAI free — one key for 40+ models
Free tier, no credit card. GPT-5, Claude, DeepSeek & more behind one OpenAI-compatible endpoint.
Start Free → View PricingCombined: The Calculator Pattern
MODELS = load_price_sheet() # keep prices at request time
def monthly_cost(workload, policy):
total = 0
for task in workload:
model = policy.route(task)
in_tok, out_tok = task.tokens
total += (in_tok * MODELS[model].in_price
+ out_tok * MODELS[model].out_price) / 1e6
if policy.cache_hit(task):
total -= request_cost(model, task) # free hit
return total
# Compare policies before committing:
# all_gpt5: $8,200/mo
# routed: $3,120/mo (routing only)
# routed+cache: $2,400/mo (+ 23% cache hits)
# full stack: $1,960/mo (+ compression, caps, batch)
That's the full journey: $8,200 → $1,960 (76% reduction) without changing user-visible quality — provided each routing tier passes your eval suite (build one with the evaluation guide).
Monitoring: Cost Per Successful Outcome
Track cost per resolved outcome (ticket closed, correct answer), not per request — routing to a cheaper model that requires 1.4 attempts per success can cost more than the premium model that nails it first try: effective_cost = per_request_cost × attempts_to_success. Alert when attempts-to-success rises 20%.
Every lever here runs on DrAI's gateway natively — routing, caching, and price-sheet tracking included behind one OpenAI-compatible key. Start with the free tier, model your workload with the formulas above, and see the 7-provider pricing comparison for raw numbers per model.
Want one API key for GPT-5, Claude 4, DeepSeek, and 15+ models?
Free tier available. OpenAI-compatible. Automatic failover.
Get Your Free API Key → View Pricing