OpenAI API billing, explained with real numbers

Updated 2026-07-15

OpenAI API billing is prepaid and metered per token: you load credits first, then each request draws down your balance based on input and output token counts at the model's rate. On gpt-5.5, output tokens cost 6x input tokens, so response length and context habits decide your bill more than anything else.

Quick answer: how OpenAI API billing works

Three numbers decide every line on your bill: input tokens sent, output tokens generated, and the per-million-token rate of the model you picked. There is no subscription and no per-request fee. Multiply, divide by one million, done. The trap is that the three numbers behave differently. Input tokens grow silently as chat history accumulates, output tokens carry a large per-token premium, and the rate changes every time you switch models. The rest of this guide walks through the mechanics, the current gpt-5.5 rates, three fully worked examples, and the places where bills jump without warning.

  • Billing unit: tokens, metered separately for input (prompt + history) and output (the reply)
  • Payment model: prepaid credits, drawn down per request; requests fail at zero balance unless auto-recharge is on
  • Usage tiers change your rate limits, not your prices
  • Batch API: half price for asynchronous jobs that can wait up to 24 hours

Prepaid credits, usage tiers, and the Batch API

OpenAI moved API accounts to prepaid billing: you buy credits up front and usage draws them down. Two details catch people. First, unused credits expire 12 months after purchase, so loading a year of budget in January is a donation if your traffic is low. Second, when the balance hits zero your requests start returning errors immediately, which looks like an outage if nobody owns the billing dashboard. Auto-recharge fixes the hard stop but removes the natural spending cap, so pair it with usage limits. Usage tiers are the second mechanic. Accounts climb tiers as cumulative spend and account age grow, and each tier raises your rate limits (requests per minute and tokens per minute). Tiers do not change per-token prices. If you are hitting 429 errors at low volume, you are in a low tier, and the fix is spend history or a rate-limit increase request, not a different plan. The Batch API is the one built-in discount worth planning around: submit a file of requests, accept results within a 24-hour window, and pay half the standard rate on both input and output. Anything that is not user-facing and latency-sensitive (evals, backfills, summarization, classification) belongs there. Cached input is also discounted when your prompts share a long stable prefix, which rewards putting static instructions first and variable content last.

Track exact usage from the API response

You do not need to estimate tokens with a tokenizer library after the fact. Every chat completion response includes a usage object with the exact counts you were billed for. Log it on every call and your cost accounting is ground truth, not approximation. One catch: with streaming enabled, the usage object is only sent if you ask for it via stream_options. If your logs show zero-token streamed requests, that is why.

curl https://api.openai.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5",
    "messages": [{"role": "user", "content": "Summarize the attached notes in one line."}],
    "max_completion_tokens": 200,
    "stream_options": {"include_usage": true}
  }'

# Response includes the exact billed counts:
# "usage": {
#   "prompt_tokens": 42,
#   "completion_tokens": 118,
#   "total_tokens": 160
# }

Build an OpenAI API cost calculator in ten lines

Online cost calculators go stale the week a price changes. A ten-line function fed by the usage object never does. Keep a rates table per model, multiply, and log the dollar figure next to every request ID. Note that reasoning-capable models bill hidden reasoning tokens as completion tokens, so the calculator below stays correct as long as you read completion_tokens from the response instead of counting visible text yourself.

# USD per 1M tokens: {"in": input_rate, "out": output_rate}
RATES = {
    "gpt-5.5": {"in": 4.00, "out": 24.00},
    "claude-sonnet-4-6": {"in": 2.40, "out": 12.00},
    "deepseek-v4-flash": {"in": 0.126, "out": 0.252},
}

def cost_usd(model: str, prompt_tokens: int, completion_tokens: int) -> float:
    rate = RATES[model]
    return (prompt_tokens * rate["in"] + completion_tokens * rate["out"]) / 1_000_000

usage = response.usage
print(f"{cost_usd('gpt-5.5', usage.prompt_tokens, usage.completion_tokens):.6f}")

gpt-5.5 price table and model comparison

The rates below are the APIsRouter catalog: APIsRouter is an OpenAI-compatible gateway (Base URL https://api.apisrouter.com/v1) with pay-as-you-go billing and no subscription, where global models are priced 20% below official list and Chinese models below their official rates. Checkout at /topup needs no signup: pay first, the key arrives by email, and the first top-up adds +100% balance. Always confirm OpenAI's official rates on their pricing page before budgeting a direct account, since list prices move. For context, the same catalog carries the models people actually weigh gpt-5.5 against. kimi-k2.6 and mimo are also listed for chat-heavy workloads.

gpt-5.5 rates broken down per unit. A typical chat turn costs about 1.3 cents.
gpt-5.5 unitInputOutput
Per 1M tokens$4.00$24.00
Per 1K tokens$0.004$0.024
Typical chat turn (1,500 in, 300 out)$0.0060$0.0072

How gpt-5.5 compares on price

Same math, different rates. Model choice is the single biggest lever on a token bill, and most workloads mix models rather than picking one.

Catalog rates in USD.
Model IDInput / 1MOutput / 1MPositioning
gpt-5.5$4.00$24.00OpenAI flagship, strongest general reasoning
claude-opus-4-7$4.00$20.00Deep reasoning, long-form analysis
claude-sonnet-4-6$2.40$12.00Highest prose quality; Anthropic policy limits it to SFW creative writing
gemini-3.5-flash$1.20$7.20Fast multimodal workhorse
glm-5$0.514$2.314Value pick for long chat sessions
deepseek-v4-pro$0.3915$0.783Community favorite for character roleplay
deepseek-v4-flash$0.126$0.252Cheapest long-session option
grok-4.5$1.60$4.80xAI's published policy allows mature fictional themes

Worked examples: three workloads priced end to end

All three examples use the gpt-5.5 rates above ($4.00 input, $24.00 output per 1M tokens). Example 1, a production chatbot: 100,000 requests per month averaging 1,500 input and 300 output tokens each. Input: 150M tokens at $4.00 is $600. Output: 30M tokens at $24.00 is $720. Total: $1,320 per month, and note that output is more than half the bill despite being one fifth of the tokens. Example 2, a 60-turn roleplay or character-chat session where the frontend resends an average 6,000-token context each turn with 250-token replies. Input: 360K tokens is $1.44. Output: 15K tokens is $0.36. Total: about $1.80 per session. The same session on deepseek-v4-flash costs about five cents, which is why long-session chat users rarely run flagships for every turn. Example 3, summarizing 20,000 documents at 2,500 input and 150 output tokens each. Input: 50M tokens is $200. Output: 3M tokens is $72. Total: $272 as a synchronous job, or about $136 through the Batch API since nothing here is latency-sensitive.

WorkloadInput tokensOutput tokensgpt-5.5 cost
Chatbot, 100K requests/mo (1,500 in / 300 out)150M30M$1,320 / month
60-turn chat session (6K context resent, 250-token replies)360K15K~$1.80 / session
Summarize 20,000 docs (2,500 in / 150 out)50M3M$272 sync, ~$136 batched

Cost surprises that inflate OpenAI bills

None of these show up in a per-request test. They show up at month two, when sessions run long and the history window has quietly tripled. Instrument the usage object from day one and graph input tokens per session over time; that one chart catches most of the list above.

  • History resend: every chat turn resends the full conversation, so input cost per session grows roughly with the square of turn count until you trim
  • The output premium: gpt-5.5 output is 6x its input rate, so verbose replies and unset length caps dominate bills
  • Reasoning tokens: hidden chain-of-thought is billed as completion tokens you never see in the text
  • Client timeouts: if your side abandons a request after the server started generating, the generated tokens are still billed
  • Vision inputs: images are tokenized and a single high-detail image can cost thousands of input tokens
  • Credit expiry: prepaid balance purchased more than 12 months ago is gone, spent or not

How to cut OpenAI API costs

Routing is the biggest lever. Teams that split traffic between a flagship and a value model like deepseek-v4-flash or glm-5 typically cut spend far more than any prompt tweak, because the cheap model handles the high-volume turns. For character-chat and roleplay frontends specifically, the deepseek-v4-pro and deepseek-v4-flash pair is the common community answer on value, kimi-k2.6 and mimo are worth testing, and Claude models are the pick when polished SFW prose matters most. Whatever frontend you connect, follow its terms of service and age requirements. The billing math itself never changes: tokens in, tokens out, rate. Get those three numbers into your logs and every cost decision becomes arithmetic instead of guesswork.

  • Cap output with max_completion_tokens on every call; it is the cheapest guardrail that exists
  • Trim history with a sliding window, or summarize older turns into a compact note instead of resending them verbatim
  • Move non-interactive work to the Batch API and pay half rate
  • Keep a long stable system prompt first and variable content last so cached-input discounts actually trigger
  • Route by task: classification, extraction, and casual chat turns do not need a flagship; keep gpt-5.5 for the steps that fail on cheaper models
  • Set balance alerts and per-key limits so one runaway loop cannot drain the account

FAQ

How does OpenAI API billing work?

It is prepaid and metered per token. You buy credits first, then each request deducts input tokens times the input rate plus output tokens times the output rate for the model used. There is no subscription; when credits run out, requests fail until you top up or auto-recharge triggers.

Is the OpenAI API free to use?

No. There is no ongoing free tier for API usage; every token is billed against prepaid credits. Occasional promotional credits for new accounts exist but expire. If you need a free option for testing, some third-party gateways and local models fill that gap.

How much does the OpenAI API cost per 1,000 tokens?

At current gpt-5.5 catalog rates, 1,000 input tokens cost $0.004 and 1,000 output tokens cost $0.024. A typical chat turn of 1,500 input and 300 output tokens comes to about 1.3 cents.

Why is my OpenAI API bill so high?

Usually one of three things: chat history being resent in full every turn so input grows with session length, uncapped output on a model whose output rate is 6x its input rate, or hidden reasoning tokens billed as completion tokens. Log the usage object per request to find which one it is.

Do OpenAI API credits expire?

Yes. Prepaid credits expire 12 months after purchase, whether or not you used them. Buy in increments matched to your actual monthly burn rather than loading a large balance up front.

Is the OpenAI API cheaper than ChatGPT Plus?

For light or bursty usage, yes: a few million tokens a month on a mid-tier model costs less than a subscription. For heavy daily chat with long contexts on a flagship model, the API can cost more. Run your expected token counts through the rate math before deciding.