OpenAI API pricing: every model, cache writes, batch, and real bills

OpenAI API pricing for every current model as of November 16, 2026, with cache-write math, Batch, Flex, and Fast tiers, tool fees, and a tested cost calculator.

Published
Reading time
17 min read
Level
Intermediate
By
AI for Devs
TL;DR
  • OpenAI API pricing as of November 16, 2026: GPT-6 Astra costs $10 input and $50 output per million tokens, GPT-6.1 Sol $2 and $10, GPT-6.1 Terra $1 and $5, and GPT-6 Luna $0.10 and $0.50.
  • GPT-5.6 and later models charge for cache writes: 1.25x input for 30 minutes, 2.5x for 12 hours. The first pays for itself after 1 read, the second after 2.
  • Batch and Flex halve every rate, Fast mode doubles it on GPT-6 models, and Ultrafast costs 6x.
  • A prompt over 272,000 input tokens reprices the whole request at 2x input and 1.5x output, so one extra token can double a call's cost.
  • The calculator in this guide ran on Node 26.12.1 with no API calls and matched 373 price cells on OpenAI's page. It prices a 30-call GPT-6.1 Sol agent session at $4.49 uncached and $0.74 cached.

OpenAI API pricing is metered per million tokens, with separate rates for input, cached input, cache writes, and output, and a multiplier for each service tier. OpenAI publishes the rates on its pricing page, and every figure here was read from that page and OpenAI's docs on November 16, 2026. Two rules move real bills more than the headline rates: GPT-5.6 and later models charge for cache writes, and a prompt over 272,000 tokens reprices its whole request. This guide prices both, along with service tiers, tools, images, and audio, and works out bills with a calculator you can run on your own usage objects.

#OpenAI API pricing by model

OpenAI API pricing as of November 16, 2026 runs from $0.10 input per million tokens on GPT-6 Luna to $10 on GPT-6 Astra, and output costs five times input on every GPT-6 model. These are Standard rates from OpenAI's pricing page, in USD per million tokens.

Prices last checked

Prices last checked November 16, 2026. GPT-5.6 Sol's $4 and $20 are promotional: the pricing page says until November 30, 2026, and the changelog says at least through November 21. The cut on August 21 lowered input 20% and output 33%, so the earlier rate was $5 and $30, and OpenAI has not said what follows. The older-model table goes stale on December 11, 2026, when six of its models shut down.

ModelInputCached input30-minute write12-hour writeOutputOver 272K: input and output
GPT-6 Astra$10$1$12.50$25$50$20 and $75
GPT-6.1 Sol$2$0.10$2.50$5$10$4 and $15
GPT-6.1 Terra$1$0.05$1.25$2.50$5$2 and $7.50
GPT-6 Sol$2$0.20$2.50$5$10$4 and $15
GPT-6 Luna$0.10$0.01$0.125$0.25$0.50$0.20 and $0.75
GPT-5.6 Sol (promotional)$4$0.40$5$10$20$8 and $30
GPT-5.6 Terra$2$0.20$2.50$5$12$4 and $18
GPT-5.6 Luna$0.20$0.02$0.25$0.50$1.20$0.40 and $1.80
GPT-5.5$5$0.50NoneNone$30$10 and $45
GPT-5.4$2.50$0.25NoneNone$15$5 and $22.50

GPT-5.5 Pro and GPT-5.4 Pro cost $30 and $180 with no caching. Every GPT-6 and GPT-5.6 model has a 1,050,000-token context window, accepts up to 922,000 input tokens, and returns up to 128,000, per the GPT-6.1 Sol model page and its siblings. Data residency endpoints add 10% for models released on or after March 5, 2026.

Each GPT-6 model undercuts the GPT-5.6 model of the same name. GPT-6.1 Sol and GPT-6 Sol share the $2 and $10 card, but 6.1 Sol reads cache at half the price, so it wins for cache-heavy agents. The LLM pricing dataset carries these rows next to other providers, and all 399 of its OpenAI price cells matched OpenAI's page.

#Older models and their shutdown dates

Most older OpenAI models now have a shutdown date on the deprecations page. The table lists their Standard input and output rates and OpenAI's recommended replacement.

ModelInputOutputShuts downReplacement
GPT-5, o3$1.25, $2$10, $8Dec 11, 2026GPT-6.1 Sol
GPT-5 mini$0.25$2Dec 11, 2026GPT-6.1 Terra
GPT-5 nano$0.05$0.40Dec 11, 2026GPT-6 Luna
GPT-5 Pro, o3-pro$15, $20$120, $80Dec 11, 2026GPT-6.1 Sol in pro mode
GPT-4.1, GPT-4o$2, $2.50$8, $10Jan 14, 2027GPT-6 Luna
GPT-4.1 mini, GPT-4o mini$0.40, $0.15$1.60, $0.60Jan 14, 2027GPT-6 Luna
GPT-5.1, GPT-5.3-Codex$1.25, $1.75$10, $14Apr 1, 2027GPT-6 Sol
GPT-5.4 nano$0.20$1.25Apr 1, 2027GPT-6 Luna

A replacement is not always cheaper. GPT-4o mini moves to GPT-6 Luna at lower rates, but GPT-5 nano moves to the same Luna rates and doubles its input price. GPT-5.4 mini ($0.75 and $4.50) and GPT-5.2 ($1.75 and $14) have no date yet. The model retirements dataset tracks these dates across providers.

#GPT-6 Cyber and other trusted-access models

GPT-6 Cyber, released November 5, 2026, costs $20 input and $100 output, and only approved organizations can call it. The Daybreak guide requires Daybreak Red plus a separate model approval, SSO with MFA, and an IP allowlist. OpenAI rates the model Critical for cybersecurity, and its safeguards can suspend access for one user if you send a safety_identifier, or the whole organization if you do not.

#Cache writes and reads on GPT-5.6 and later

OpenAI caches prompts by default, and on GPT-5.6 and later the request that stores a prefix pays a write premium: 1.25x input for a 30-minute entry and 2.5x for a 12-hour entry. Reads cost 0.1x on most of these models and 0.05x on GPT-6.1 Sol and Terra, per OpenAI's prompt caching guide. GPT-5.5 and earlier charge no write fee, so prompt caching on them only saves money.

The write rate replaces the input rate for those tokens rather than adding to it. The minimum cacheable prefix on GPT-5.6 and later is 1,024 visible tokens.

#The break-even number of cache reads

A 30-minute write pays for itself after 1 read and a 12-hour write after 2, at both read rates. Compare one write plus N reads with sending the prefix uncached N + 1 times:

Text
with cache:     W + N * R
without cache:  1 + N
cache wins when N > (W - 1) / (1 - R)

At 0.1x reads the threshold is 0.28 for a 30-minute write and 1.67 for a 12-hour write. At 0.05x it is 0.26 and 1.58, so the counts hold. OpenAI's guide says one write and one read cost 1.35x the uncached price and ten requests cost 2.15x, and the calculator reproduces both.

Cumulative input cost per prefix against requests: a 30-minute write is cheaper than no cache from request 2, a 12-hour write from request 3, and GPT-5.5 never pays a write premiumCumulative input cost, in multiples of the uncached input price (reads at 0.1x)0x2x4x6x123456Requests that share one prefix30m: 1.35x against 2x12h: 2.70x against 3xGPT-5.5: 1.50x at 6no cacheGPT-5.5, no write fee30-minute write12-hour write
Fig. 1At 0.1x reads, a 30-minute write is cheaper than no cache from the second request and a 12-hour write from the third. GPT-5.5 charges no write fee, so in multiples of its own input price it never costs more than no cache.

#Thirty minutes or twelve hours

Pick the lifetime by the gap between requests that share a prefix. A read keeps a 30-minute entry alive for at least 30 more minutes, so traffic that returns within half an hour never needs the 12-hour write. Past 30 minutes, each expired entry is rewritten at 1.25x, which costs more than no cache.

A 20,000-token prefix on GPT-6.1 Sol requested 12 times, 45 minutes apart, costs $0.48 uncached, $0.60 with 30-minute writes, and $0.122 with one 12-hour write. The calculator expires entries at their minimum lifetime, and OpenAI may keep them longer, which can only lower the 30-minute figure.

Twelve requests 45 minutes apart: no cache costs 12x, the 30-minute cache writes every time for 15x, and the 12-hour cache writes once for 3.05xNo cache12 x 1 = 12.00x$0.480 on GPT-6.1 SolFFFFFFFFFFFF30-minute TTL12W + 0R = 15.00x$0.600 on GPT-6.1 SolWWWWWWWWWWWW12-hour TTL1W + 11R = 3.05x$0.122 on GPT-6.1 SolWRRRRRRRRRRR0h1.5h3h4.5h6h7.5h9hW cache writeR cache readF full input
Fig. 2Twelve requests 45 minutes apart: every 30-minute entry has expired, so that cache writes 12 times for 15x. The 12-hour cache writes once for 3.05x, and no cache costs 12x.

The 12-hour lifetime exists only in the Responses API, set with prompt_cache_options.ttl. Older models use prompt_cache_retention, which defaults to 24h for organizations without Zero Data Retention.

#Implicit mode writes the changing suffix

The default implicit mode puts a breakpoint at the end of the latest eligible message, usually the newest user message or tool result. Everything after the cached prefix is then written at 1.25x, including retrieved chunks that never repeat. Explicit-only mode (prompt_cache_options.mode: "explicit") writes only up to the breakpoints you mark, and later content bills at the plain input rate.

Implicit mode suits an agent loop, where each turn's new tokens become the next turn's prefix. RAG and LLM-judge prompts change at the end of every request, so give them one explicit breakpoint after the stable prefix.

On GPT-6 models, change reasoning effort mid-conversation with a configuration_update item, because editing reasoning.effort can rewrite hidden instructions and break the prefix. Caches are also not shared across organizations or regional processing boundaries.

#Batch, Flex, Fast, and Ultrafast tiers

Batch and Flex cost half of Standard on every token line, cache writes included. Fast mode costs 2x on GPT-6 and GPT-5.6 models, and Ultrafast costs 6x on the two models that offer it. The tiers differ in latency and failure behavior.

TierPrice against StandardHow it runsWhat to watch
Batch0.5xAsynchronous, 24-hour window, own rate limits50,000 requests or 200 MB per batch; unfinished requests expire
Flex0.5xSynchronous, slower429 resource errors are free; raise SDK timeouts to 15 minutes
Fast, formerly Priority2x on GPT-6 and GPT-5.6, 2.5x on GPT-5.5Up to 2.5x fasterTraffic that ramps too fast is downgraded and billed at Standard
Ultrafast6x, GPT-6 Astra and GPT-6.1 Sol onlyFastest; WebSockets recommendedSeparate rate limits

The Batch guide targets evals, classification, and embedding jobs, and on GPT-5 and later models the batch discount applies to cached reads too. Flex covers every GPT-6, GPT-5.6, GPT-5.5, and GPT-5.4 model plus a few older ones.

Fast mode applies per request with service_tier: "fast" or as a project default. Since October 21, 2026, administrators can restrict which tiers each project may use, which keeps an expensive default from spreading.

#Long prompts and reasoning tokens

A prompt over 272,000 input tokens bills 2x input, cached input, and cache writes and 1.5x output for the full request, on GPT-5.4, GPT-5.5, and every GPT-5.6 and GPT-6 model. Reasoning tokens bill as output without appearing in the response.

#The 272K-token surcharge

The model pages apply the higher rate to the whole request, so the boundary is a cliff. With 1,000 output tokens on GPT-6.1 Sol, a 272,000-token prompt costs $0.554 and a 272,001-token prompt costs $1.103.

The calculator counts cached tokens toward the line, since usage.input_tokens includes them. Compaction breaks cache reuse from the first changed token, so compact once, well before 272,000 tokens, rather than trimming a little each turn to stay inside the context window.

#Reasoning tokens bill as output

Reasoning tokens bill at the output rate inside usage.output_tokens, with the share in output_tokens_details.reasoning_tokens. They count toward max_output_tokens, and a reasoning model response that hits the limit returns status: "incomplete" and can bill tokens with no visible text.

Lower reasoning effort produces fewer of these tokens. GPT-6 Astra and GPT-6.1 Sol accept low through max but not none, while Terra, GPT-6 Sol, and Luna accept none. On GPT-6.1 Sol, 1,000 reasoning tokens cost $0.01, as much as 5,000 uncached input tokens. Pro mode on GPT-6.1 Sol replaces GPT-5 Pro and o3-pro and, per the reasoning guide, bills its extra work at the standard token rates.

#Tool fees: web search, file search, and containers

Web search costs $10 per 1,000 calls, file search $2.50 per 1,000 calls plus storage, and Hosted Shell and Code Interpreter bill container time. Tokens a tool adds to the context bill at the model's rates on top of these fees.

ToolFee as of November 16, 2026Tokens
Web search, and the preview tool on reasoning models$10 per 1,000 callsSearch content at model rates
Web search preview, other models$25 per 1,000 callsSearch content free
File search (Responses API only)$2.50 per 1,000 calls; storage $0.10 per GB-day after 1 GB freeRetrieved chunks at model rates
ContainersPer 20 minutes: $0.03 at 1 GB up to $1.92 at 64 GB; billed per minute, 5-minute minimumCode and output at model rates

One $0.01 search equals 100,000 uncached input tokens on GPT-6 Luna and 5,000 on GPT-6.1 Sol, so search fees matter most on cheap models. A 3-minute run in a 1 GB container bills the $0.0075 minimum, and 45 minutes at 64 GB costs $4.32.

Function and MCP server tool definitions bill as input on every call, and editing them breaks the cached prefix. OpenAI recommends allowed_tools or tool_choice: "none" over removing definitions between requests.

#Image, audio, realtime, and embedding pricing

Image and audio models bill their own token types, and several voice models bill by the minute. Rates are Standard, per million tokens, as of November 16, 2026.

ModelInputOutputNote
GPT-Image-2.6 and 2.5, Sunburst and FlareText $5, image $8Image $302.6 launched November 4, 2026; Batch halves rates
GPT-Live-1$0.05 per session minuteIncludedBackend model and tools bill separately
GPT-Realtime-2.1Audio $32, text $4Audio $64, text $24Cached input $0.40
GPT-Realtime-2.1 miniAudio $10, text $0.60Audio $20, text $2.40Replaces the TTS models on January 6, 2027
gpt-transcribe$0.0045 per minuteIncludedReplaces whisper-1 on February 26, 2027
text-embedding-3-small, 3-large$0.02 and $0.13NoneBatch takes 50,000 inputs per job
Decisions API on GPT-6 Luna$0.10Not chargedCaching at Luna rates

For a 1024 by 1024 GPT-Image-2.6 image, the calculator in OpenAI's image generation guide estimates 823 output tokens at low quality, or $0.0247. The same formula, ported below, gives $0.0435 at medium, $0.0527 at high, and $0.2107 at max, before input tokens. GPT-Image-1.5 and GPT-Image-1 mini shut down on December 1, 2026.

Realtime audio counts 1 token per 100 ms of user audio and 1 per 50 ms of assistant audio, so a minute of each on GPT-Realtime-2.1 costs $0.0192 in and $0.0768 out. Each response bills the whole conversation, per the voice cost guide, while GPT-Live bills a flat $0.05 a minute, silence included. At $0.02 per million, text-embedding-3-small embeds 50 million tokens for a dollar.

#Fine-tuning is closing

Fine-tuning is closed to new organizations, and existing customers lose job creation on January 6, 2027. Training costs $25 per million tokens on GPT-4.1 and GPT-4o, and fine-tuned GPT-4.1 runs at $3 and $12. All four tunable base models shut down January 14, 2027, and fine-tuned models go with them, which gives the RAG versus fine-tuning choice on OpenAI an end date.

#A tested OpenAI API cost calculator

The calculator takes the fields of a Responses API usage object and returns an itemized bill. It applies cache-write and read rates, the 272,000-token tier, all five service tiers, data residency, tool fees, and container minutes, and it ports OpenAI's image token formula. It ran on Node 26.12.1 with no dependencies and no network code.

openai-bill.ts
TypeScript
// openai-bill.ts: turn Responses API usage into an OpenAI API bill.
// Standard prices are USD per 1M tokens, read from OpenAI's pricing page on November 16, 2026.
type Rate = {
  input: number;
  cached: number;
  output: number;
  writes?: boolean; // GPT-5.6 and later bill cache writes (1.25x for 30m, 2.5x for 12h)
  long?: boolean; // prompts over 272K input tokens: 2x input and cache, 1.5x output
  fast?: number; // Fast mode multiplier, when the model offers it
  ultrafast?: boolean; // 6x Standard
  regional?: boolean; // released on or after March 5, 2026: data residency adds 10%
};
 
const gpt6 = { writes: true, long: true, fast: 2, regional: true };
 
export const MODELS: Record<string, Rate> = {
  "gpt-6-astra": { input: 10, cached: 1, output: 50, ...gpt6, ultrafast: true },
  "gpt-6.1-sol": { input: 2, cached: 0.1, output: 10, ...gpt6, ultrafast: true },
  "gpt-6.1-terra": { input: 1, cached: 0.05, output: 5, ...gpt6 },
  "gpt-6-sol": { input: 2, cached: 0.2, output: 10, ...gpt6 },
  "gpt-6-luna": { input: 0.1, cached: 0.01, output: 0.5, ...gpt6 },
  "gpt-5.6-sol": { input: 4, cached: 0.4, output: 20, ...gpt6 }, // promotional rate
  "gpt-5.6-terra": { input: 2, cached: 0.2, output: 12, ...gpt6 },
  "gpt-5.6-luna": { input: 0.2, cached: 0.02, output: 1.2, ...gpt6 },
  "gpt-5.5": { input: 5, cached: 0.5, output: 30, long: true, fast: 2.5, regional: true }, // no write charge
  "gpt-5.4-mini": { input: 0.75, cached: 0.075, output: 4.5, fast: 2 },
};
 
export type Usage = {
  input: number; // usage.input_tokens, cached and written tokens included
  cached?: number; // usage.input_tokens_details.cached_tokens
  write30m?: number; // ...cache_write_tokens_details.ttl_30m_tokens
  write12h?: number; // ...cache_write_tokens_details.ttl_12h_tokens
  output: number; // usage.output_tokens, reasoning tokens included
  webSearches?: number; // web search calls
  fileSearches?: number; // file search calls (Responses API)
};
 
export type Tier = "standard" | "batch" | "flex" | "fast" | "ultrafast";
export type Options = { tier?: Tier; regional?: boolean };
export type Lines = Record<"input" | "cached" | "write30m" | "write12h" | "output" | "tools", number>;
 
export function bill(model: string, u: Usage, o: Options = {}) {
  const m = MODELS[model];
  if (!m) throw new Error(`Unknown model: ${model}`);
  const { cached = 0, write30m = 0, write12h = 0, webSearches = 0, fileSearches = 0 } = u;
  if (!m.writes && write30m + write12h > 0) throw new Error(`${model} has no cache-write rate`);
  const tier = o.tier ?? "standard";
  const isLong = !!m.long && u.input > 272_000; // the higher rate covers the whole request
  if (tier === "fast" && (!m.fast || (isLong && !m.writes))) throw new Error(`${model} has no Fast rate here`);
  if (tier === "ultrafast" && !m.ultrafast) throw new Error(`${model} has no Ultrafast rate`);
  if (o.regional && !m.regional) throw new Error(`Check the regional rate for ${model}`);
 
  const tierMult = { standard: 1, batch: 0.5, flex: 0.5, fast: m.fast ?? 0, ultrafast: 6 }[tier];
  const mod = tierMult * (o.regional ? 1.1 : 1);
  const inMult = isLong ? 2 : 1;
  const outMult = isLong ? 1.5 : 1;
  const usd = (tokens: number, perMTok: number) => (tokens * perMTok * mod) / 1e6;
 
  const ordinary = u.input - cached - write30m - write12h;
  const lines: Lines = {
    input: usd(ordinary, m.input * inMult),
    cached: usd(cached, m.cached * inMult),
    write30m: usd(write30m, m.input * 1.25 * inMult),
    write12h: usd(write12h, m.input * 2.5 * inMult),
    output: usd(u.output, m.output * outMult),
    tools: (webSearches * 10 + fileSearches * 2.5) / 1000, // per-call fees, no token multipliers
  };
  return { lines, total: Object.values(lines).reduce((a, b) => a + b, 0) };
}
 
// Reads needed before a write beats sending the prefix uncached every time.
export const breakEvenReads = (writeMult: number, readMult: number) =>
  Math.floor((writeMult - 1) / (1 - readMult)) + 1;
 
// Hosted Shell and Code Interpreter: per-minute billing, 5-minute minimum.
const PER_20_MIN = { "1g": 0.03, "4g": 0.12, "16g": 0.48, "64g": 1.92 };
export const container = (memory: keyof typeof PER_20_MIN, minutes: number) =>
  (PER_20_MIN[memory] / 20) * Math.max(5, Math.ceil(minutes));
 
// GPT-Image-2.6 output tokens, ported from the calculator in OpenAI's image generation guide.
const QUALITY = { low: 16, medium: 24, high: 48, xhigh: 64, max: 96 };
const SCALE = { low: 4.2, medium: 3.3, high: 1, xhigh: 1, max: 1 };
export function imageTokens(width: number, height: number, quality: keyof typeof QUALITY) {
  const base = QUALITY[quality];
  const ratio = base / (Math.max(width, height) / Math.min(width, height));
  const floor = Math.floor(ratio);
  const side = ratio - floor === 0.5 ? floor + (floor % 2) : Math.round(ratio);
  const grid = (width >= height ? base : side) * (width >= height ? side : base);
  return Math.round(Math.ceil((grid * (2e6 + width * height)) / 4e6) * SCALE[quality]);
}
 
// An agent loop: each call resends the history, which grows by `delta` tokens.
// "implicit": GPT-5.6+ reads the previous prompt and writes the new tokens at 1.25x.
// "gpt-5.5": no write charge; reuse ends on the last 2,048-token boundary.
// "none": explicit-only mode with no breakpoints, so every token bills as fresh input.
export function agentSession(
  model: string,
  s: { calls: number; firstPrompt: number; delta: number; output: number; cache: "implicit" | "gpt-5.5" | "none" },
  o: Options = {},
) {
  const sum: Lines = { input: 0, cached: 0, write30m: 0, write12h: 0, output: 0, tools: 0 };
  let prompt = s.firstPrompt;
  let previous = 0;
  for (let call = 1; call <= s.calls; call++) {
    let usage: Usage = { input: prompt, output: s.output };
    if (s.cache === "implicit") usage = { ...usage, cached: previous, write30m: prompt - previous };
    if (s.cache === "gpt-5.5") usage = { ...usage, cached: Math.floor(previous / 2048) * 2048 };
    const { lines } = bill(model, usage, o);
    for (const key of Object.keys(sum) as (keyof Lines)[]) sum[key] += lines[key];
    previous = prompt;
    prompt += s.delta;
  }
  return { lines: sum, total: Object.values(sum).reduce((a, b) => a + b, 0), finalPrompt: previous };
}
 
// One shared prefix requested every `gap` minutes. Entries live for their minimum
// lifetime only, and a read keeps an entry alive for at least 30 more minutes.
export function prefixDay(
  model: string,
  s: { tokens: number; requests: number; gap: number; ttl: "none" | "30m" | "12h" },
) {
  let expires = -Infinity;
  let total = 0;
  for (let i = 0; i < s.requests; i++) {
    const t = i * s.gap;
    let usage: Usage = { input: s.tokens, output: 0 };
    if (s.ttl !== "none" && t < expires) {
      usage = { ...usage, cached: s.tokens };
      expires = Math.max(expires, t + 30);
    } else if (s.ttl !== "none") {
      usage = { ...usage, [s.ttl === "30m" ? "write30m" : "write12h"]: s.tokens };
      expires = t + (s.ttl === "30m" ? 30 : 720);
    }
    total += bill(model, usage).total;
  }
  return total;
}
 
const $ = (n: number, digits = 4) => `$${n.toFixed(digits)}`;
 
if (import.meta.main) {
  console.log("Break-even cache reads on GPT-5.6 and later");
  for (const read of [0.1, 0.05]) {
    console.log(`  read at ${read}x: 30m write ${breakEvenReads(1.25, read)}, 12h write ${breakEvenReads(2.5, read)}`);
  }
 
  console.log("\n20K-token prefix on gpt-6.1-sol, 12 requests 45 minutes apart");
  for (const ttl of ["none", "30m", "12h"] as const) {
    console.log(`  ${ttl.padEnd(5)} ${$(prefixDay("gpt-6.1-sol", { tokens: 20_000, requests: 12, gap: 45, ttl }))}`);
  }
 
  const session = { calls: 30, firstPrompt: 20_000, delta: 3_500, output: 800 };
  console.log("\nAgent session: 30 calls, 20K first prompt, +3.5K per call, 800 output per call");
  for (const [model, cache] of [
    ["gpt-6.1-sol", "none"],
    ["gpt-6.1-sol", "implicit"],
    ["gpt-6-astra", "implicit"],
    ["gpt-6.1-terra", "implicit"],
    ["gpt-6-luna", "implicit"],
    ["gpt-5.5", "gpt-5.5"],
  ] as const) {
    const r = agentSession(model, { ...session, cache });
    console.log(
      `  ${model.padEnd(14)} ${cache.padEnd(8)} total ${$(r.total)}  input ${$(r.lines.input)}  writes ${$(r.lines.write30m)}  reads ${$(r.lines.cached)}  output ${$(r.lines.output)}`,
    );
  }
 
  console.log("\nThe same GPT-6.1 Sol session (implicit caching) by service tier");
  for (const [label, o] of [
    ["standard", {}],
    ["flex", { tier: "flex" }],
    ["fast", { tier: "fast" }],
    ["ultrafast", { tier: "ultrafast" }],
    ["standard, regional", { regional: true }],
  ] as const) {
    console.log(`  ${label.padEnd(19)} ${$(agentSession("gpt-6.1-sol", { ...session, cache: "implicit" }, o).total)}`);
  }
 
  const rag = { prefix: 6_000, retrieved: 9_150, output: 500 };
  const all = rag.prefix + rag.retrieved;
  console.log("\nRAG request on gpt-6.1-sol: 6K stable prefix, 9.15K retrieved plus question, 500 output");
  const row = (label: string, model: string, u: Usage, o?: Options) =>
    console.log(`  ${label.padEnd(36)} ${$(bill(model, u, o).total, 6)}`);
  row("no cache", "gpt-6.1-sol", { input: all, output: rag.output });
  row("implicit: prefix read, rest written", "gpt-6.1-sol", { input: all, cached: rag.prefix, write30m: rag.retrieved, output: rag.output });
  row("explicit breakpoint after prefix", "gpt-6.1-sol", { input: all, cached: rag.prefix, output: rag.output });
  row("explicit, plus 1 web search", "gpt-6.1-sol", { input: all, cached: rag.prefix, output: rag.output, webSearches: 1 });
  row("explicit, gpt-6-luna", "gpt-6-luna", { input: all, cached: rag.prefix, output: rag.output });
 
  console.log("\n100,000 ticket labels: 1.5K shared prefix (cached), 300-token ticket, 50 output");
  const ticket = { input: 1_800, cached: 1_500, output: 50 };
  const job = (label: string, model: string, u: Usage, o?: Options) =>
    console.log(`  ${label.padEnd(36)} ${$(bill(model, u, o).total * 100_000, 2)}`);
  job("gpt-6-luna, standard", "gpt-6-luna", ticket);
  job("gpt-6-luna, batch, every prefix hit", "gpt-6-luna", ticket, { tier: "batch" });
  job("gpt-6-luna, batch, no prefix hit", "gpt-6-luna", { input: 1_800, output: 50 }, { tier: "batch" });
  job("Decisions API on gpt-6-luna", "gpt-6-luna", { ...ticket, output: 0 }); // no output charge
  job("gpt-6.1-sol, standard", "gpt-6.1-sol", ticket);
 
  console.log("\nLong-context cliff on gpt-6.1-sol, 1,000 output tokens");
  for (const input of [272_000, 272_001]) {
    console.log(`  ${input.toLocaleString("en-US")} input tokens: ${$(bill("gpt-6.1-sol", { input, output: 1_000 }).total)}`);
  }
 
  console.log("\nGPT-Image-2.6, 1024 x 1024, output only at $30 per 1M image tokens");
  for (const q of ["low", "medium", "high", "xhigh", "max"] as const) {
    const t = imageTokens(1024, 1024, q);
    console.log(`  ${q.padEnd(6)} ${String(t).padStart(5)} tokens  ${$((t * 30) / 1e6, 5)}`);
  }
 
  console.log("\nContainers: 3-minute and 45-minute sessions");
  for (const mem of ["1g", "64g"] as const) {
    console.log(`  ${mem.padEnd(3)} 3 min ${$(container(mem, 3))}  45 min ${$(container(mem, 45))}`);
  }
}

Run it with node openai-bill.ts. This is the real output:

Text
Break-even cache reads on GPT-5.6 and later
  read at 0.1x: 30m write 1, 12h write 2
  read at 0.05x: 30m write 1, 12h write 2
 
20K-token prefix on gpt-6.1-sol, 12 requests 45 minutes apart
  none  $0.4800
  30m   $0.6000
  12h   $0.1220
 
Agent session: 30 calls, 20K first prompt, +3.5K per call, 800 output per call
  gpt-6.1-sol    none     total $4.4850  input $4.2450  writes $0.0000  reads $0.0000  output $0.2400
  gpt-6.1-sol    implicit total $0.7439  input $0.0000  writes $0.3038  reads $0.2001  output $0.2400
  gpt-6-astra    implicit total $4.7197  input $0.0000  writes $1.5187  reads $2.0010  output $1.2000
  gpt-6.1-terra  implicit total $0.3719  input $0.0000  writes $0.1519  reads $0.1001  output $0.1200
  gpt-6-luna     implicit total $0.0472  input $0.0000  writes $0.0152  reads $0.0200  output $0.0120
  gpt-5.5        gpt-5.5  total $2.4667  input $0.7616  writes $0.0000  reads $0.9851  output $0.7200
 
The same GPT-6.1 Sol session (implicit caching) by service tier
  standard            $0.7439
  flex                $0.3719
  fast                $1.4877
  ultrafast           $4.4631
  standard, regional  $0.8182
 
RAG request on gpt-6.1-sol: 6K stable prefix, 9.15K retrieved plus question, 500 output
  no cache                             $0.035300
  implicit: prefix read, rest written  $0.028475
  explicit breakpoint after prefix     $0.023900
  explicit, plus 1 web search          $0.033900
  explicit, gpt-6-luna                 $0.001225
 
100,000 ticket labels: 1.5K shared prefix (cached), 300-token ticket, 50 output
  gpt-6-luna, standard                 $7.00
  gpt-6-luna, batch, every prefix hit  $3.50
  gpt-6-luna, batch, no prefix hit     $10.25
  Decisions API on gpt-6-luna          $4.50
  gpt-6.1-sol, standard                $125.00
 
Long-context cliff on gpt-6.1-sol, 1,000 output tokens
  272,000 input tokens: $0.5540
  272,001 input tokens: $1.1030
 
GPT-Image-2.6, 1024 x 1024, output only at $30 per 1M image tokens
  low      823 tokens  $0.02469
  medium  1449 tokens  $0.04347
  high    1756 tokens  $0.05268
  xhigh   3122 tokens  $0.09366
  max     7024 tokens  $0.21072
 
Containers: 3-minute and 45-minute sessions
  1g  3 min $0.0075  45 min $0.0675
  64g 3 min $0.4800  45 min $4.3200

A separate script compared 373 Standard, Batch, Flex, Fast, and Ultrafast price cells for the 10 models in MODELS against OpenAI's pricing page, and every one matched. It also reproduced OpenAI's own figures: $0.01515 for the mixed-lifetime example in the caching guide, the 1.35x and 2.15x reuse ratios, and the image calculator's 823 tokens. No OpenAI request was sent, so the token counts are assumptions and only the arithmetic is tested.

Two choices are readings rather than facts. OpenAI does not say whether data residency or tier multipliers touch tool fees, so the calculator leaves fees alone. The GPT-5.5 session ends reuse at the last 2,048-token breakpoint and ignores hidden system tokens.

#Worked bills: an agent, a RAG request, and a batch job

Each bill below shows a different lever: caching for the agent, the caching mode for RAG, and the model and tier for the batch job. All three come from the calculator's output.

#A 30-call agent session

A 30-call GPT-6.1 Sol agent session costs $4.49 uncached and $0.74 with implicit caching, an 83% saving, even though every turn writes its new tokens at 1.25x. The session starts at 20,000 prompt tokens, grows by 3,500 per call, and returns 800 output tokens per call, the shape the Claude API pricing guide uses.

Model and cacheFresh inputCache writesCache readsOutputTotal
GPT-6.1 Sol, no cache$4.25$0$0$0.24$4.49
GPT-6.1 Sol, implicit$0$0.30$0.20$0.24$0.74
GPT-6 Astra, implicit$0$1.52$2.00$1.20$4.72
GPT-6.1 Terra, implicit$0$0.15$0.10$0.12$0.37
GPT-6 Luna, implicit$0$0.02$0.02$0.01$0.05
GPT-5.5, no write fee$0.76$0$0.99$0.72$2.47

GPT-5.5 costs 3.3 times as much as GPT-6.1 Sol despite its free writes, because its rates are higher and its 2,048-token breakpoints leave part of each turn at full price. An AI agent bills its full history as input every turn, which is why fresh input dominates the uncached row.

The same cached 30-call GPT-6.1 Sol session costs $0.37 on Flex, $0.74 on Standard, $1.49 on Fast, and $4.46 on Ultrafast, close to the $4.49 the session costs on Standard with no cachingFlex0.5x$0.37Standard1x$0.74Regional1.1x$0.82Fast2x$1.49Ultrafast6x$4.46No cache, Standard: $4.49$0$1$2$3$4$5half pricelist price2x6x
Fig. 3The cached 30-call GPT-6.1 Sol session by tier: $0.37 on Flex, $0.74 on Standard, $0.82 with data residency, $1.49 on Fast, and $4.46 on Ultrafast, about what the session costs uncached on Standard.

Ultrafast at 6x erases the caching saving almost exactly, so reserve it for interactive work where response time matters more than cost.

#A RAG request

A RAG request on GPT-6.1 Sol with a 6,000-token stable prefix costs $0.0353 uncached, $0.0285 in implicit mode, and $0.0239 with one explicit breakpoint. The other 9,150 prompt tokens are ten retrieved chunks and a question, and the answer is 500 tokens.

ConfigurationPer requestPer 100,000 requests
No cache$0.035300$3,530
Implicit: prefix read, chunks written$0.028475$2,847.50
Explicit breakpoint after the prefix$0.023900$2,390
Explicit, plus 1 web search$0.033900$3,390
Explicit, on GPT-6 Luna$0.001225$122.50

Implicit mode writes the changing chunks at 1.25x and never reads them back, so the explicit breakpoint saves 16%. One web search adds 42% to the cached request. The vector database guide covers retrieving fewer chunks, and context engineering covers putting stable content first.

#A nightly classification job

Labeling 100,000 tickets on GPT-6 Luna costs $7.00 on Standard and $3.50 on Batch when every request reads the cached 1,500-token prefix. Each request adds a 300-token ticket and returns 50 tokens with reasoning effort none.

OpenAI's Batch guide does not describe cache hits inside a batch, and with none the Batch job costs $10.25, more than cached Standard. The Decisions API, with no output charge, runs the job for $4.50. On GPT-6.1 Sol the same job costs $125.00, so model choice is the largest lever.

#Budgets, caching, and routing at an AI gateway

The bill() function audits usage after it happens. An AI gateway prices each request as it passes, enforces budgets before the next one, and moves traffic between OpenAI models and other providers when a budget or a price changes.

Bifrost, an open-source AI gateway, covers each lever in this guide and routes to OpenAI among 10,000+ models across 25+ providers. It is a strong fit for OpenAI spend because the same budgets and routing rules keep applying when traffic moves to another provider.

Bifrost prices requests from a model catalog that syncs every 24 hours, with separate cache-read and cache-write rates and tiers above 272,000 tokens. It bills OpenAI 12-hour writes at their own rate, with Fast, Flex, Ultrafast, and long-prompt variants. A missing variant falls back to the ordinary write rate and understates cost, so check the ones you use and enter negotiated rates as custom pricing.

Lever in this guideHow Bifrost handles it
Clients that send no cache breakpointAuto prompt caching marks the first cacheable block on GPT-5.6 and later; off by default
A session that hops between OpenAI keys or to AzureSession affinity keeps it on the provider and key whose cache it warmed
Spend per team or customerBudgets per customer, team, virtual key, or provider; a provider over budget drops out of routing
A budget nearly spentA routing rule such as budget_used > 80 moves requests to GPT-6 Luna or another provider
Shutdowns and promotions endingModel aliases make a model swap a config change
Repeated requestsSemantic caching replays a stored response, so OpenAI is not called

Auto prompt caching keeps OpenAI's implicit mode, so RAG clients still need to send prompt_cache_options.mode: "explicit" themselves. Bifrost passes service_tier to OpenAI and drops it when a request falls back to another provider, so a Flex request that fails over runs at that provider's default tier.

OpenAI's spend limits cap one organization or project per month and return a 429 once reached, with enforcement that lags. Bifrost budgets reset daily through yearly, can align to calendar periods in UTC, and cover every provider behind one virtual key. The calculator did not run against a gateway, and these features describe Bifrost as of November 16, 2026.

#Check your OpenAI API cost against real usage

Export one day of usage objects, run them through bill(), and group the result by line item. The largest line tells you what to change first:

  1. If write30m is close to cached, writes are not being read back. Add an explicit breakpoint, and use Prompt Cache Diagnostics to find prefixes that change.
  2. If a prefix returns after gaps longer than 30 minutes, give its breakpoint the 12-hour lifetime.
  3. If output is the largest line, check reasoning_tokens and lower the effort where LLM evaluation shows quality holds.
  4. If any request bills at the long-context rate, alert at 250,000 input tokens and compact before 272,000.
  5. If work can wait a day, move it to Batch. If it can wait minutes, try Flex with retries.
  6. Before December 11, 2026, move traffic off GPT-5, o3, and the other models in the shutdown table, and price each replacement first.

Rerun the numbers whenever OpenAI API pricing changes and when the GPT-5.6 Sol promotion ends. Follow the APIs and pricing topic and model release news for changes, and compare the same bills in the Gemini API pricing guide.

#Questions

How much does the OpenAI API cost?

As of November 16, 2026, the OpenAI API costs $10 input and $50 output per million tokens on GPT-6 Astra, $2 and $10 on GPT-6.1 Sol, $1 and $5 on GPT-6.1 Terra, and $0.10 and $0.50 on GPT-6 Luna, for prompts up to 272,000 input tokens. Cache writes, cache reads, service tiers, and tool fees change the final bill.

Is the OpenAI API free?

No. The API is pay as you go, and its Free usage tier sets a $100 monthly usage limit with no free token allowance listed. Eligible ChatGPT Pro and Business subscribers can claim up to $500 a month in API credits that expire each billing cycle. The omni-moderation-latest model is free, and Flex requests that fail with a 429 Resource Unavailable error are not charged.

How much does GPT-6 Astra cost per million tokens?

GPT-6 Astra costs $10 per million input tokens, $1 for cached input, $12.50 for a 30-minute cache write, $25 for a 12-hour write, and $50 for output, as of November 16, 2026. A prompt over 272,000 input tokens doubles the input and cache rates and raises output to $75 for the whole request. Batch and Flex halve every rate.

Do OpenAI reasoning tokens cost extra?

Reasoning tokens bill at the model's output rate, so there is no separate reasoning price. They stay hidden from the response but appear in usage.output_tokens_details.reasoning_tokens and count toward max_output_tokens. A response cut off by that limit can still bill input and reasoning tokens with no visible text, so leave room for reasoning when you set the limit.

Does OpenAI charge for prompt caching?

On GPT-5.6 and later models, yes. A cache write costs 1.25 times the input rate for the default 30-minute lifetime and 2.5 times for the 12-hour lifetime, and a read costs 0.1 times input, or 0.05 times on GPT-6.1 Sol and GPT-6.1 Terra. GPT-5.5 and earlier models charge no write fee, and caching is on by default.

What is the difference between Batch, Flex, and Fast mode?

Batch and Flex both cost half of Standard as of November 16, 2026. Batch is asynchronous, with a 24-hour completion window and its own rate-limit pool. Flex is synchronous but slower and can return 429 errors that are not billed. Fast mode, formerly Priority processing, costs twice Standard on GPT-6 models and runs up to 2.5 times faster.

Can I still fine-tune OpenAI models?

Only if your organization already fine-tunes. OpenAI closed fine-tuning to new organizations on May 7, 2026, and existing customers lose job creation on January 6, 2027. Fine-tuned models keep serving until their base models shut down, and GPT-4.1, GPT-4.1 mini, GPT-4o, and GPT-4o mini all shut down on January 14, 2027.