GPT-5 API Pricing per 1M Tokens: From Rate Card to a Checked Estimate
A current gpt-5 gateway rate check, two live JSON requests and five Decimal fixtures separate usage estimates from actual billing and untested discounts.

To estimate gpt-5 API cost, keep ordinary input, cached input and output separate, then apply the exact route and account-group rate. This guide checks the public configuration and runs two small requests; calculated amounts are estimates, not retrieved account charges.
Crazyrouter was the gateway for this 2-case experiment: 2 cases met the declared complete-output criterion; the results below retain the failures and their limits.
By Sophie M · Tested November 3, 2026
GPT-5 API pricing per 1M tokens in 2026#
The default-group gateway configuration yields USD 1 input, approximately USD 0.104 cached input and USD 8 output per million tokens. The official GPT-5 model page lists USD 1.25, USD 0.125 and USD 10. The cached component therefore does not share the exact 20% difference shown by ordinary input and output. The raw configuration contains floating-point serialization detail; displayed rates are rounded for reading, while the script preserves Decimal arithmetic from the supplied values.
November 3 experiment and observed results#
The scripts ran on Windows with Python 3.10.2 and synthetic inputs. Gateway generation and catalog requests use https://api.crazyrouter.com; paths and complete payloads appear in the code. Each result describes this run only. A test program exiting successfully means its observations were recorded, not that every model response passed.
| Requested model ID | Visible to this credential |
|---|---|
| gpt-5 | Yes |
| Service / group | Tier | Input USD / 1M | Cached input USD / 1M | Output USD / 1M |
|---|---|---|---|---|
| Crazyrouter / default | standard | 1 | 0.104 | 8 |
| Route / case | HTTP or turns | Finish / outcome | Accepted | Observed output or error |
|---|---|---|---|---|
| gpt-5 / short answer | 200 | stop | Yes | {"quantity":4} |
| gpt-5 / empty record | 200 | stop | Yes | {"quantity":0} |
| Case | Prompt | Completion | Reported cached | Calculated USD by rate scenario |
|---|---|---|---|---|
| short answer | 14 | 23 | Absent; estimate assumes zero | standard = 0.000198 |
| empty record | 14 | 23 | Absent; estimate assumes zero | standard = 0.000198 |
Observed successful-envelope response IDs (failed acceptance can still have an ID):
resp_09dfa2d008bb2da6016ae9eb79ef6c8197b8acad47bb5e1e8e
resp_06cec99e2dafeaa1016ae9eb7c37ac8194984bff72ce7d838e
| Executed local case | Expected behavior met |
|---|---|
| uncached | Yes |
| cached subset | Yes |
| empty | Yes |
| cached exceeds input | Yes |
| boolean rejected | Yes |

What the live usage actually shows#
Both tiny requests returned the expected JSON, each with 14 input and 23 completion tokens. Their ordinary-usage estimate is USD 0.000198 each. The model page describes GPT-5 as a previous model; preserving an existing integration is a different decision from choosing a current model for new work.
Calculate from counters without inventing extra usage#
The estimator computes (prompt minus cached) × input rate + cached × cache rate + completion × output rate, then divides by one million. Cached tokens are a subset of prompt tokens in this contract. Completion reasoning counters are diagnostic subsets and are not added again.
Five local cases check ordinary usage, a cached subset, zero usage, cached tokens exceeding the prompt and boolean values masquerading as integer counters. The last two are rejected. Missing cached-token details are treated as zero for this estimate; if your billing source reports cache usage separately, reconcile that source rather than assuming this fallback is a proven cache miss.
Know when this estimate stops applying#
The rate loader reads the default group. Another account group, custom arrangement or changed billing rule can produce a different result. The program recognizes only the inspected billing modes and static expression shape. It never executes a remote pricing expression with eval.
No tool charges, taxes, storage, retries or separately billed services were exercised. Two correct small JSON outputs do not validate long context, streaming, tools, vision or workload-wide quality. Verify those features and reconcile actual usage against the ledger before using the estimate as an invoice forecast.
Reproduce the experiment#
Install requests, set CRAZYROUTER_API_KEY in the process environment, save this complete script and run it with Python 3.10 or later. Requests use your authorized credential and can consume usage. Authorization headers are not printed.
import json
import os
import time
import requests
BASE = "https://api.crazyrouter.com/v1"
def catalog(models):
with requests.Session() as s:
s.trust_env=False
r=s.get(BASE+"/models",headers={"Authorization":"Bearer "+os.environ["CRAZYROUTER_API_KEY"]},timeout=(10,40),allow_redirects=False)
r.raise_for_status();names={x["id"] for x in r.json()["data"]}
return {m:m in names for m in models}
def chat(model,prompt,**options):
payload={"model":model,"messages":[{"role":"user","content":prompt}],**options}
record={"model":model,"request":payload};start=time.perf_counter()
try:
with requests.Session() as s:
s.trust_env=False
r=s.post(BASE+"/chat/completions",headers={"Authorization":"Bearer "+os.environ["CRAZYROUTER_API_KEY"]},json=payload,timeout=(10,65),allow_redirects=False)
record["http"]=r.status_code
if r.status_code==200:
d=r.json();c=d["choices"][0];record.update(response_id=d.get("id"),output=c["message"].get("content"),finish=c.get("finish_reason"),usage=d.get("usage",{}))
else:record["error"]="HTTP_"+str(r.status_code)
except (requests.RequestException,ValueError,KeyError,IndexError) as e:record["error"]=type(e).__name__
record["seconds"]=round(time.perf_counter()-start,3)
return record
def parsed(row):
if row.get("finish")!="stop":return None
try:return json.loads(row.get("output") or "null")
except (ValueError,TypeError):return None
def emit(**data):print(json.dumps(data,ensure_ascii=False))
from decimal import Decimal as D
import re
MODEL='gpt-5'
LEGACY=None
def rates(document,model):
row=next(x for x in document["data"] if x["model_name"]==model)
factor=D(str(document["group_ratio"]["default"]))*D(str(row["group_discounts"]["default"]))
mode=row.get("billing_mode","")
if mode=="time_tiered":
tiers={k:{"input":str(D(str(v["input_per_1m_tokens"]))*factor),"output":str(D(str(v["output_per_1m_tokens"]))*factor),"cache":str(D(str(v["cache_read_per_1m_tokens"]))*factor)} for k,v in row["time_pricing"].items() if k in ["off_peak","peak"]}
elif mode=="tiered_expr":
# Recognize only these inspected static rule shapes, never eval a remote expression.
match=re.fullmatch(r'tier\("standard", p \* ([0-9.]+) \+ cr \* ([0-9.]+)(?: \+ cc \* 0)? \+ c \* ([0-9.]+)\)',row["billing_expr"])
if not match:raise ValueError("Unreviewed pricing expression")
a,b,c=match.groups();tiers={"standard":{"input":str(D(a)*factor),"cache":str(D(b)*factor),"output":str(D(c)*factor)}}
elif mode in ("","per_token"):
base=D(str(row["model_ratio"]))*2*factor
tiers={"standard":{"input":str(base),"cache":str(base*D(str(row["cache_ratio"]))),"output":str(base*D(str(row["completion_ratio"])))}}
else:raise ValueError("Unreviewed billing mode")
return row,tiers
def estimate(usage,rate):
prompt=usage.get("prompt_tokens");completion=usage.get("completion_tokens")
cached=usage.get("prompt_tokens_details",{}).get("cached_tokens",0)
if any(type(x) is not int or x<0 for x in [prompt,completion,cached]) or cached>prompt:raise ValueError("Invalid usage")
return (D(prompt-cached)*D(rate["input"])+D(cached)*D(rate["cache"])+D(completion)*D(rate["output"]))/D(1000000)
fixture={"input":"2","cache":"0.5","output":"8"};tests=[]
for name,usage,expected in [("uncached",{"prompt_tokens":100,"completion_tokens":10},"0.00028"),("cached subset",{"prompt_tokens":100,"completion_tokens":10,"prompt_tokens_details":{"cached_tokens":40}},"0.00022"),("empty",{"prompt_tokens":0,"completion_tokens":0},"0")]:
assert estimate(usage,fixture)==D(expected);tests.append({"case":name,"passed":True})
for name,usage in [("cached exceeds input",{"prompt_tokens":2,"completion_tokens":0,"prompt_tokens_details":{"cached_tokens":3}}),("boolean rejected",{"prompt_tokens":True,"completion_tokens":0})]:
try:estimate(usage,fixture);raise AssertionError("invalid usage accepted")
except ValueError:tests.append({"case":name,"passed":True})
with requests.Session() as s:
s.trust_env=False;r=s.get("https://crazyrouter.com/api/pricing",timeout=(10,40));r.raise_for_status();document=r.json()
row,tiers=rates(document,MODEL);available=catalog([MODEL]+([LEGACY] if LEGACY else []));rows=[]
if available[MODEL]:
for name,prompt,expected in [("short answer",'Return only JSON {"quantity":4}.',{"quantity":4}),("empty record",'Return only JSON {"quantity":0}.',{"quantity":0})]:
options={"max_completion_tokens":1024,"reasoning_effort":"minimal"} if MODEL.startswith("gpt-5") else {"max_tokens":2048}
rec=chat(MODEL,prompt,**options);rec.update(case=name,passed=parsed(rec)==expected)
if rec.get("usage"):
try:rec["estimated_usd_by_tier"]={k:str(estimate(rec["usage"],v)) for k,v in tiers.items()}
except ValueError:rec["estimate_error"]="Unsupported usage counters"
rows.append(rec)
emit(local_tests=tests,catalog=available,requests=rows,rates_usd_per_million=tiers,pricing_row=row,pricing_group="default",scope="Public rate arithmetic, not a ledger debit; reasoning not added twice to completion tokens; no claim of cache hit")

Sources and related guides#
Sources checked November 3, 2026: Official model or pricing reference, Crazyrouter public pricing configuration, Python Decimal. Official descriptions and gateway observations are separate evidence.
- AI SaaS Unit Economics: Calculate Cost per Usable Output
- Lower AI API Token Use: A Paired Prompt-Compression Test in Python
- Prompt Caching in Python: Read Token Counters Before Claiming Savings
- AI API Reseller vs Official API: What a Synthetic Probe Can Verify
- GPT-5 API in Python: Verify a Legacy Route with Two Text Requests
FAQ#
Are these actual charged amounts?#
No. They are calculations from public configuration and returned usage; no account ledger was queried.
Which account group is used?#
The default group and its published discount configuration.
Were both model requests successful?#
Both returned the expected complete JSON in this run; the result table preserves their usage.
Was a cache hit measured?#
No cache hit is established by these small requests. The cached-rate row is configuration evidence.
Should I add reasoning tokens to completion tokens?#
Not for these envelopes, where reasoning is already represented within the reported completion total.
What happens when pricing rules change?#
Fetch and review the new configuration, rerun the calculation checks and verify the applicable route before relying on old estimates.
Last actually tested: November 3, 2026. This API-dependent article is due for review December 3, 2026.
Implementation Guides
Podcast
AI Dev Tools: The Crazyrouter Podcast
Short episodes for developers on AI APIs, gateways, cost control and coding tools.
Latest episodes
EP196 · Oct 29, 2026 · 6:53
AI API Security Posture — Turn Controls Into Continuous Evidence
A practical guide to AI API security posture: inventory exposure, verify controls continuously, protect keys and data, constrain tools, and turn security assumptions into evidence that operators can act on.
EP195 · Oct 28, 2026 · 7:21
AI API Policy Drift — Detect When Production Rules Stop Matching Intent
A practical guide to policy drift in AI APIs: version routing and safety rules, detect stale enforcement, compare intended and observed behavior, and restore control before small gaps become incidents.





