← Back to research
Pricing20 min readPublished 2026-07-21

GPT API Pricing in 2026: Per-Million Token Costs and Budget Math

OpenAI API pricing explained: GPT mini, Terra, and Sol per-million token rates, budget formulas, and LumeAPI catalog comparison.

By LumeAPI Engineering Team

GPT API hub →

Last verified: July 21, 2026

Short path: Full cross-provider table on AI API pricing. Cheap migration playbook: cheap OpenAI API production guide.

GPT API pricing in 2026 is expressed in dollars per million tokens for input and output separately. Finance teams often budget from a single headline rate and are surprised when agent workloads bill 3× the forecast — because output tokens cost more per token and agents generate many output tokens across multiple hops.

This guide explains how OpenAI-style tier naming maps to LumeAPI catalog rates, walks through monthly budget math with real scenarios, and shows how to estimate cost in Python before you ship a feature.

LumeAPI is an independent OpenAI-compatible gateway — not OpenAI, not an official reseller. Rates below reflect LumeAPI model pages on July 21, 2026.

Quick Answer — GPT tiers (per 1M tokens)

Model IDOfficial ref. in/outLumeAPI catalog in/outTypical workload
gpt-5.4-mini$0.75 / $4.50$0.225 / $1.35Support bots, classifiers, bulk chat
gpt-5.6-terra$2.50 / $15.00$0.75 / $4.50Copilots, balanced quality
gpt-5.6-sol$5.00 / $30.00$1.50 / $9.00Hard reasoning, escalation only

LumeAPI catalog rates are roughly 70% below the reference columns shown on model pages. Verify live GPT API before contracts.

Rule of thumb: If output is >25% of total tokens, output rate drives the bill. If you run agents, measure cost per completed task, not $/1M in isolation.

How GPT API pricing is structured

OpenAI and OpenAI-compatible gateways bill two counters:

  1. Input tokens — everything you send: system prompt, history, tool results, attachments (after tokenization).
  2. Output tokens — everything the model generates, including hidden reasoning tokens if the model emits them.

There is no single “GPT API price.” You pay:

text
request_cost = (input_tokens / 1_000_000) × input_rate
             + (output_tokens / 1_000_000) × output_rate

Monthly roll-up:

text
monthly_cost = Σ request_cost over all requests

Streaming does not change per-token rates — you still pay for tokens generated, whether they arrive in one JSON blob or over SSE.

What is not in the per-million rate

ItemBilling note
Failed requests before generationOften $0 output; input may still count if processed
Retries after 429Duplicate billable calls if the model ran
Tool call JSON in outputCounts as output tokens
Long system prompts every hopInput multiplies in agent loops

For retry discipline see OpenAI API 429 guide.

Official reference vs LumeAPI catalog (July 2026)

ModelRef. inputRef. outputLumeAPI inputLumeAPI outputSavings vs ref.
gpt-5.4-mini$0.75$4.50$0.225$1.35~70%
gpt-5.6-terra$2.50$15.00$0.75$4.50~70%
gpt-5.6-sol$5.00$30.00$1.50$9.00~70%

“Official reference” here means the comparison rate displayed alongside LumeAPI catalog on model pages. OpenAI list pricing and promotions change — re-check before enterprise procurement.

Cross-provider context: LLM API pricing comparison 2026 and cheapest LLM API.

Monthly budget scenarios (LumeAPI catalog)

Assume token volumes are monthly totals across all users.

Scenario A — Support bot (high volume, short answers)

  • 200M input + 40M output on gpt-5.4-mini
text
(200 × $0.225) + (40 × $1.35) = $45 + $54 = $99/month

Same tokens at reference mini rates: ~$330/month.

Scenario B — Copilot (balanced)

  • 80M input + 25M output on gpt-5.6-terra
text
(80 × $0.75) + (25 × $4.50) = $60 + $112.50 = $172.50/month

Scenario C — Agent with escalation

  • 70% of calls: 60M in + 12M out on mini → $15.48 + $16.20 = $31.68
  • 30% of calls: 30M in + 15M out on Terra → $22.50 + $67.50 = $90
  • Blended ≈ $121.68/month (vs Terra-only on same tokens ≈ $172.50)

Routing saves more than haggling over a single tier — see route GPT/Claude/Gemini.

Scenario D — Misconfigured “Sol everywhere”

  • 50M input + 15M output on gpt-5.6-sol
text
(50 × $1.50) + (15 × $9.00) = $75 + $135 = $210/month

Same shape on mini: ~$65/month. Default model choice is a pricing decision.

Workload presets — which GPT tier to budget

Product patternSuggested modelBudget assumptionWatch out for
Ticket summarizergpt-5.4-miniLow output capLong ticket bodies inflate input
In-app copilotgpt-5.6-terraModerate outputFull chat history every turn
Code review agentmini → Terra escalation2–4 calls per taskSol on every file read
RAG Q&Amini or gemini-3-flashChunk size drives inputDumping 20 chunks per query
Batch enrichmentmini + batch API where eligible50% off asyncNot all gateways expose batch

Python cost estimator (production-ready)

python
from dataclasses import dataclass

@dataclass(frozen=True)
class ModelRates:
    input_per_m: float   # $ per 1M input tokens
    output_per_m: float  # $ per 1M output tokens

CATALOG = {
    "gpt-5.4-mini": ModelRates(0.225, 1.35),
    "gpt-5.6-terra": ModelRates(0.75, 4.50),
    "gpt-5.6-sol": ModelRates(1.50, 9.00),
}

def estimate_cost(
    input_tokens: int,
    output_tokens: int,
    model: str,
) -> float:
    rates = CATALOG[model]
    return (
        (input_tokens / 1_000_000) * rates.input_per_m
        + (output_tokens / 1_000_000) * rates.output_per_m
    )

def monthly_from_usage(rows: list[dict]) -> float:
    """rows: [{model, input_tokens, output_tokens}, ...]"""
    return sum(
        estimate_cost(r["input_tokens"], r["output_tokens"], r["model"])
        for r in rows
    )

# Example: 50M in + 15M out on Terra
print(f"${estimate_cost(50_000_000, 15_000_000, 'gpt-5.6-terra'):.2f}")
# 105.00

Pipe real numbers from Usage CSV exports into monthly_from_usage weekly. Discrepancies usually mean logging gaps or retries.

Reducing GPT API pricing impact (ranked)

  1. Tier routing — mini for 70–90% of calls; Terra/Sol only on eval failure or explicit user tier.
  2. Cap max_tokens per API route — streaming copilots often over-generate without caps.
  3. Trim context — summarize turns older than N messages instead of resending full transcripts.
  4. Prompt caching — on official OpenAI when cache-hit rate is high; compare task cost, not input rate alone.
  5. Batch async jobs — ~50% off when latency tolerance is hours, not seconds.
  6. Gateway catalog — LumeAPI realtime rates for supported GPT ids (this guide’s tables).
  7. Fix 429 retry storms — duplicate calls look like “usage growth” — 429 guide.

Agent-specific: AI agent API bills out of control.

When official OpenAI pricing beats a gateway

SituationWhy official may win
Very high prompt-cache hit rateCached input discounts on repeated system prompts
Batch-only workloadsNative Batch API pricing
Enterprise commit + creditsNegotiated effective rate
Features not exposed via third partiesVendor-only betas or admin APIs

Run a two-week shadow: same prompts, compare completed-task cost and error rate on cheap OpenAI API vs direct.

Production checklist

  • [ ] Document default model per API surface (not “whatever dev picked”).
  • [ ] Set max_tokens defaults in server config, not client-only.
  • [ ] Export Usage weekly; reconcile to finance forecast.
  • [ ] Alert when daily spend > 2× trailing 7-day average.
  • [ ] Load-test worst-case prompt (longest allowed input) before launch.
  • [ ] Log model, input_tokens, output_tokens, latency_ms per request.
  • [ ] Re-read live GPT API rates each quarter.

FAQ

Is gpt-5.4-mini always the cheapest GPT option?

Among GPT tiers on LumeAPI in July 2026, yes for standard chat. Cross-provider, Gemini 3 Flash may be cheaper for some workloads — compare on your eval set.

Why is my bill higher than the formula suggests?

Common causes: agent loops, retries, oversized history, wrong default model, or tool outputs counted as completion tokens. Measure per-feature usage first.

Do input and output tokenize the same way?

Tokenizers differ by model family. Budget with measured usage from API responses (usage.prompt_tokens, usage.completion_tokens), not character÷4 guesses.

How does GPT pricing relate to “cheapest LLM API”?

Cheapest LLM API 2026 picks across GPT, Claude, and Gemini. This page is GPT-only depth.

Does streaming cost more?

No extra per-token fee for stream: true. You pay for tokens generated. See Node.js streaming guide.

Can I mix GPT tiers on one LumeAPI key?

Yes. Change model per request — multi-model Python.

Sources and verification