← Back to research
Guides15 min readPublished 2026-07-23

LLM API Cost per Million Tokens Explained (2026)

Learn llm api cost per million tokens with 2026 GPT, Claude, and Gemini rates, monthly bill math, and a practical budget method for production APIs.

By LumeAPI Engineering Team

AI API Pricing hub →

Last verified: July 23, 2026

Short path: Start with the AI API pricing guide, review LumeAPI pricing, then check the exact gpt-5.6-terra model page before routing production traffic.

The llm api cost per million tokens is usually quoted as two numbers: input tokens and output tokens. That split matters more than the headline model name. A workload that sends 1 million input tokens and generates 100,000 output tokens does not cost the same as one that sends 1 million input tokens and generates 1 million output tokens.

For the catalog prices verified on July 22, 2026, 1 million input tokens costs between $0.225 and $5.00 through the listed official rates, or between $0.225 and $2.50 through LumeAPI. Output is priced higher across every listed model, reaching $25.00 per million output tokens on LumeAPI for claude-fable-5.

Quick Answer

QuestionDirect answer
How much does 1 million tokens cost?It depends on direction and model: from $0.225 to $5.00 for 1 million input tokens in this catalog, and from $1.35 to $25.00 for 1 million output tokens through LumeAPI.
What should I budget first?Count input and output separately, multiply each by its rate, then add a 20% to 30% allowance for retries, long contexts, and traffic variation.
Which models are cheapest?gpt-5.4-mini is cheapest for input at $0.225 per million tokens on LumeAPI; gemini-3-flash is next at $0.25.
What causes most budgeting mistakes?Teams estimate only prompts and ignore generated output, repeated context, tool-call retries, and agent hops.
What is the practical migration option?Keep the OpenAI-compatible client, change the base URL and API key, and select a catalog model that matches your quality requirement.

In short

Token pricing is not a monthly bill until you know your input-to-output ratio. For many production workloads, the most effective saving is to reduce expensive output and repeated context before moving every request to the cheapest available model. LumeAPI can lower the listed per-token rates, but it is an independent third-party gateway and does not guarantee parity with every provider-native feature.

What most guides get wrong

The common myth is that “1 million tokens” is a useful budget by itself.

It is not. One million input tokens at $2.50 per million costs $2.50. One million output tokens at $15.00 per million costs $15.00. A request that sends 10,000 input tokens and produces 2,000 output tokens is a very different financial event from one that sends 2,000 input tokens and produces 10,000 output tokens, even though both contain 12,000 tokens in total.

The second mistake is treating the model's context window as free storage. If an agent resends a 40,000-token conversation six times while calling tools, those tokens are billed again unless the provider's specific caching or batch feature changes the calculation. A long system prompt, retrieved documents, tool schemas, and prior messages all belong in the input count.

A useful estimate therefore has four inputs:

  1. Requests per month.
  2. Average input tokens per request.
  3. Average output tokens per request.
  4. Retries or additional agent hops.

Without those numbers, a “price per million” comparison is mostly decoration.

A realistic production scenario

A five-person support engineering team runs a Python service with the OpenAI SDK, PostgreSQL for conversation state, and a retrieval step that adds internal troubleshooting documents to each request. The service starts on gpt-5.6-terra.

Each request sends about 8,000 input tokens: the system instructions, conversation history, tool definitions, and retrieved text. The model produces about 1,200 output tokens. At 50,000 requests per month, that is 400 million input tokens and 60 million output tokens before retries.

At the listed official rates, the estimate is:

  • Input: 400 × $2.50 = $1,000
  • Output: 60 × $15.00 = $900
  • Total: $1,900

The team initially forecasts $1,000 because it multiplies only the input volume. Then an outage causes a retry policy to replay failed tool calls, adding roughly 12% more requests. The real invoice is higher again.

Using the LumeAPI rate for the same model:

  • Input: 400 × $0.75 = $300
  • Output: 60 × $4.50 = $270
  • Total: $570 before retries

The savings are meaningful, but only if the request shape remains the same. A gateway discount does not fix a prompt that keeps growing by 3,000 tokens every turn.

Expert take

The mechanism behind most unexpected API bills is multiplication. A single user action can create several billable model calls:

  1. The initial planning request.
  2. A tool invocation.
  3. A follow-up request containing the tool result.
  4. A correction request after malformed output.
  5. A retry after a timeout.

Each call can include the original system prompt and parts of the conversation. An agent that appears to handle 1,000 user tasks may actually make 4,000 or 5,000 model requests.

Output deserves special attention because it is generally priced above input. A verbose answer, a large JSON object, or an agent that explains every intermediate decision can dominate the bill even when prompts are short. Setting an output limit helps control the worst case, but it does not replace measuring actual completion sizes.

The practical rule is to budget from observed request traces:

monthly cost = (monthly input tokens / 1,000,000 × input rate) + (monthly output tokens / 1,000,000 × output rate)

Then apply an operational allowance. A 20% allowance may be reasonable for a stable synchronous API with measured traffic. A new agent workflow with uncertain retries may need more. Keep that allowance visible instead of hiding it in a vague “average token cost.”

Do not follow gateway pricing advice blindly when you need provider-native Batch processing, prompt caching, specialized moderation behavior, fine-grained rate-limit controls, or an API feature unavailable through the compatible surface. Official provider plans can be cheaper for those specific workloads even when their ordinary per-token rate is higher. Also account for data handling, regional requirements, observability, and failure behavior before moving sensitive production traffic.

The pricing formula

Every model in the catalog uses separate rates for input and output. Convert the observed monthly volume into millions before multiplying.

For example, suppose a service uses:

  • 120 million input tokens per month
  • 18 million output tokens per month
  • claude-sonnet-4-6
  • LumeAPI rates of $1.50 input and $7.50 output per million

The calculation is:

text
input  = 120 × $1.50 = $180
output =  18 × $7.50 = $135
total  = $315

If the service has a 10% retry and replay overhead, the rough operating estimate becomes:

text
$315 × 1.10 = $346.50

This is not a substitute for invoice reconciliation. It is a budget model. Taxes, account-level terms, provider-native services, and features outside token billing may change the final amount.

How much does 1 million tokens cost?

The answer depends on whether those tokens enter the model or come out of it. The following table uses the catalog snapshot supplied for this article. “Official” means the reference rate in the brief, while “LumeAPI” is the listed gateway rate. Prices are USD per 1 million tokens.

Model IDOfficial inputOfficial outputLumeAPI inputLumeAPI output
gpt-5.6-sol$5.00$30.00$1.50$9.00
gpt-5.6-terra$2.50$15.00$0.75$4.50
gpt-5.5$5.00$30.00$1.50$9.00
gpt-5.4$2.50$15.00$0.75$4.50
gpt-5.4-mini$0.75$4.50$0.225$1.35
claude-opus-4-8$5.00$25.00$2.50$12.50
claude-opus-4-7$5.00$25.00$2.50$12.50
claude-sonnet-4-6$3.00$15.00$1.50$7.50
claude-fable-5$10.00$50.00$5.00$25.00
gemini-3.1-pro-preview$2.00$12.00$1.00$6.00
gemini-3.5-flash$1.50$9.00$0.75$4.50
gemini-3-flash$0.50$3.00$0.25$1.50

The lowest listed LumeAPI input rate is gpt-5.4-mini at $0.225 per million tokens. gemini-3-flash is close at $0.25. The lowest output rate is also gpt-5.4-mini, at $1.35 per million output tokens.

Those are not automatically the right choices. A cheaper model that requires two correction calls may cost more than a model that produces valid structured output on the first attempt.

For provider reference material, check the OpenAI API pricing documentation, Anthropic pricing documentation, and Google Gemini API pricing. Provider pages can change, so compare the applicable rate card and billing terms at the time you deploy.

OpenAI, Claude, and Gemini price per million

The useful comparison is not “which provider is cheapest?” It is “which rate matches my request mix?”

At the catalog's listed gateway rates:

  • GPT models range from $0.225 to $1.50 per million input tokens, depending on the model.
  • Claude models range from $1.50 to $5.00 per million input tokens.
  • Gemini models range from $0.25 to $1.00 per million input tokens.
  • Output prices are higher: from $1.35 for gpt-5.4-mini to $25.00 for claude-fable-5.

Consider a monthly workload of 100 million input tokens and 10 million output tokens:

ModelLumeAPI inputLumeAPI outputEstimated monthly total
gpt-5.4-mini$22.50$13.50$36.00
gemini-3-flash$25.00$15.00$40.00
gpt-5.6-terra$75.00$45.00$120.00
gemini-3.5-flash$75.00$45.00$120.00
claude-sonnet-4-6$150.00$75.00$225.00
claude-opus-4-8$250.00$125.00$375.00
claude-fable-5$500.00$250.00$750.00

This scenario is intentionally simple: it excludes retries, cached or batched pricing, and other services. It demonstrates why the phrase “one million tokens” needs a direction and a model attached to it.

The same 100 million input and 10 million output tokens can cost $36 with gpt-5.4-mini or $750 with claude-fable-5 through the supplied LumeAPI catalog. The expensive model may be justified for a difficult reasoning or coding task. It is a poor default for every classification, extraction, or short support reply.

Three monthly budget scenarios

Small internal tool

Assume 10,000 requests per month, with 4,000 input tokens and 800 output tokens per request.

text
Input:  10,000 × 4,000 = 40,000,000 tokens
Output: 10,000 ×   800 =  8,000,000 tokens

Using gpt-5.4-mini through LumeAPI:

text
40 × $0.225 = $9.00
8 × $1.35   = $10.80
Estimated total = $19.80

With a 25% allowance for retries and variation, the planning budget is about $24.75 per month. The base model bill is modest; logging, hosting, vector search, and user support may cost more.

Customer-facing support workflow

Assume 50,000 requests per month, with 8,000 input tokens and 1,200 output tokens per request.

text
Input:  50,000 × 8,000 = 400,000,000 tokens
Output: 50,000 × 1,200 =  60,000,000 tokens

Using gpt-5.6-terra through LumeAPI:

text
400 × $0.75 = $300
60 × $4.50   = $270
Estimated total = $570

A 15% allowance produces a budget of approximately $655.50. If retrieval begins attaching full documents rather than relevant passages, input volume can rise faster than request count. Monitor input tokens per request, not only total calls.

High-quality coding or agent workflow

Assume 20,000 requests per month, with 20,000 input tokens and 4,000 output tokens per request. The workflow makes one additional model call for 30% of requests.

Effective request count:

text
20,000 + (20,000 × 0.30) = 26,000 calls

Token volume:

text
Input:  26,000 × 20,000 = 520,000,000 tokens
Output: 26,000 ×  4,000 = 104,000,000 tokens

Using claude-sonnet-4-6 through LumeAPI:

text
Input:  520 × $1.50 = $780
Output: 104 × $7.50 = $780
Total:             = $1,560

The extra agent call adds 30% to both token categories in this simplified model. If those calls also include larger tool results or expanded history, the actual increase can be greater.

The token cost calculator API teams actually need

A spreadsheet is enough for a first estimate, but production budgeting needs fields that match the request lifecycle. Track at least:

  • Model ID.
  • Input tokens.
  • Output tokens.
  • Request status.
  • Retry count.
  • Agent or workflow name.
  • Whether retrieved context was included.
  • Estimated cost at the applicable rate.
  • A request or trace ID for reconciliation.

A minimal calculator can be written without relying on a third-party package:

python
from decimal import Decimal

RATES = {
    "gpt-5.4-mini": {
        "input": Decimal("0.225"),
        "output": Decimal("1.35"),
    },
    "gpt-5.6-terra": {
        "input": Decimal("0.75"),
        "output": Decimal("4.50"),
    },
    "claude-sonnet-4-6": {
        "input": Decimal("1.50"),
        "output": Decimal("7.50"),
    },
}

def estimate_cost(model, input_tokens, output_tokens):
    rate = RATES[model]
    input_cost = Decimal(input_tokens) / Decimal(1_000_000) * rate["input"]
    output_cost = Decimal(output_tokens) / Decimal(1_000_000) * rate["output"]
    return {
        "input_cost": input_cost.quantize(Decimal("0.0001")),
        "output_cost": output_cost.quantize(Decimal("0.0001")),
        "total": (input_cost + output_cost).quantize(Decimal("0.0001")),
    }

estimate = estimate_cost(
    "gpt-5.6-terra",
    input_tokens=400_000_000,
    output_tokens=60_000_000,
)

print(estimate)

For a live service, do not hard-code rates in application logic indefinitely. Store a dated rate configuration, record which rate was applied, and make a catalog update an explicit deployment or configuration change. That prevents a historical cost report from silently changing when the current catalog changes.

You can send an OpenAI-compatible request through LumeAPI using the documented base URL and a catalog model ID:

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["LUMEAPI_KEY"],
    base_url="https://api.lumeapi.site/v1",
)

response = client.chat.completions.create(
    model="gpt-5.6-terra",
    messages=[
        {
            "role": "system",
            "content": "Return a concise answer with cited source identifiers.",
        },
        {
            "role": "user",
            "content": "Summarize the incident report in five bullets.",
        },
    ],
)

print(response.choices[0].message.content)

This preserves the familiar client shape, but compatibility is not the same as feature equivalence. Validate the parameters, response fields, streaming behavior, tool calls, usage accounting, and error responses that your application actually depends on. Do not assume that every provider-native option is available through the gateway.

How to lower the monthly bill without breaking quality

Start by separating tasks. Classification, routing, metadata extraction, short rewriting, and simple summarization often do not need the same model as code generation or difficult multi-step analysis. Route the cheap, high-volume path first and reserve a more expensive model for requests that fail a measurable quality check.

Next, reduce repeated input. Conversation history should have a retention policy. Retrieved documents should be chunked and filtered. Tool schemas should not contain unused operations. A system prompt that grows with every experiment is a recurring tax.

Then control output. Ask for the required structure and length. Parse the response and retry only when the failure is actionable. A retry that sends the same prompt without changing the cause is just another billable failure.

Finally, measure quality per dollar. A model that costs 50% less but causes 10% more escalations may still be a good choice for a low-risk workflow, but not for an automated code change or financial decision. The right unit is often “cost per successful task,” not cost per API call.

A basic routing policy might look like this:

text
1. Send routine requests to a low-cost model.
2. Validate the response against schema and task-specific checks.
3. Retry once with a targeted correction if the failure is recoverable.
4. Escalate to a stronger model only when the evaluation fails again.
5. Record the final model and total tokens for the task.

This policy exposes a hidden cost: escalation. That is useful. You can now decide whether improving the cheap model's prompt, retrieval, or output parser costs less than paying for the stronger model on every request.

What to put in a monthly budget

A practical budget has three layers.

The first is expected token spend. Use the formula for each model and workflow rather than averaging all traffic into one rate.

The second is operational variance:

  • Retries after timeouts or rate limits.
  • Longer conversations.
  • Larger retrieved passages.
  • Tool results that contain full records.
  • Batch jobs or backfills.
  • Traffic growth.
  • Evaluation and staging traffic.

The third is non-token spend. Depending on the product, this can include application hosting, storage, search, observability, queues, moderation, and support. A token budget that ignores those costs is not a product budget.

For a new service, create low, expected, and high cases. For example:

CaseRequestsInput/requestOutput/requestLumeAPI modelToken estimate
Low20,0004,000600gpt-5.4-mini$20.70
Expected50,0008,0001,200gpt-5.6-terra$570.00
High75,00012,0002,000claude-sonnet-4-6$1,800.00

The high case is not a prediction. It is a trigger for capacity and margin decisions. Add your retry allowance to each case and set an alert before the high-case limit, not after the wallet is depleted.

A migration note for OpenAI-compatible clients

If your application currently points directly at an OpenAI endpoint, the code change can be small, but the operational review should not be.

At minimum, review:

  • Authentication environment variables.
  • The base_url or equivalent client setting.
  • Exact catalog model IDs.
  • Usage fields used by your billing logger.
  • Streaming and tool-call handling.
  • Timeout and retry behavior.
  • Request and response logging policy.
  • Any provider-specific parameters.

Keep the gateway URL in configuration rather than scattering it through application code. Use a separate API key for each environment, and do not log the bearer token or full prompts containing customer data.

LumeAPI is an independent third-party gateway, not OpenAI, Anthropic, or Google. That distinction matters for support ownership, data processing review, incident response, and feature availability. Test a representative workload before switching all traffic. A successful simple chat completion proves only that the basic compatible path works.

When the cheapest model is the wrong choice

Price should not be the only selection criterion for:

  • High-value code generation.
  • Requests that require strict structured output.
  • Long-running agents where a failed step causes several downstream calls.
  • Sensitive workflows with provider or regional requirements.
  • Tasks where human review costs more than the model difference.
  • Workloads that benefit from a provider-native Batch or cache feature.

Suppose gpt-5.4-mini costs $1.35 per million output tokens and a stronger model costs $4.50. If the cheaper model produces invalid output often enough to create multiple retries, the apparent 70% rate reduction can disappear. Measure successful completion cost, including correction calls.

The reverse is also true. Do not use a premium model for every request merely because a small sample looked better. Define an evaluation set, establish an acceptance threshold, and escalate only the categories that need it.

FAQ

How much does 1 million tokens cost for an LLM API?

One million tokens costs between $0.225 and $5.00 for input and between $1.35 and $25.00 for output through the LumeAPI catalog listed here. The exact amount depends on the model and whether the tokens are sent to or generated by it.

What is the llm api cost per million tokens for GPT, Claude, and Gemini?

The listed LumeAPI input rates range from $0.225 to $1.50 for GPT models, $1.50 to $5.00 for Claude models, and $0.25 to $1.00 for Gemini models. Output rates are higher for each model, so calculate both directions separately.

Is input or output more expensive in an API bill?

Output is more expensive for every model in the supplied catalog. A service that generates long answers, large JSON documents, or repeated agent plans can therefore spend more on output even when its input prompts are larger in raw token count.

How do I calculate a monthly token budget?

Divide monthly input and output tokens by 1,000,000, multiply each result by its corresponding model rate, add the two amounts, and apply an allowance for retries and traffic variation. Track each workflow separately if they use different models.

Can I use an OpenAI-compatible client with LumeAPI?

Yes, the supplied gateway supports an OpenAI-compatible Chat Completions endpoint at https://api.lumeapi.site/v1. You still need to test the exact model ID, parameters, tool calls, streaming, usage reporting, and error behavior required by your application.

Should I switch from an official provider to a gateway for lower token costs?

A gateway can reduce the listed per-token rate, but it is not automatically the best choice for every workload. Compare the saving with provider-native Batch or cache features, compatibility requirements, data policies, support expectations, and the cost of failed requests.

Next steps

  1. Export a week of request logs and calculate input tokens, output tokens, retries, and average context size by workflow.
  2. Build low, expected, and high monthly estimates using the model table above, then add an explicit variance allowance.
  3. Test one representative OpenAI-compatible workflow with the LumeAPI pricing options, starting with a catalog model whose quality you can measure.

The central budgeting lesson is simple: the price of one million tokens is only the rate card. Your real bill is that rate multiplied by every repeated context, generated completion, retry, and agent hop your system creates.