OpenAI Token Cost Calculator

Model prices are illustrative reference points and change over time — verify current rates at openai.com/api/pricing, or choose "Custom Rate" to enter your own.

Two Meters Running on Every API Call

Every call to the OpenAI API is metered twice over: once for the tokens you send as the prompt, and again for the tokens the model generates in response, each at its own per-token rate. Because the output rate typically runs several times higher than the input rate across OpenAI's model lineup, two prompts of identical length can cost very different amounts once you account for how much text each one produces in reply.

The Formula

Input Cost = (Input Tokens ÷ 1,000,000) × Price per 1M Input Tokens
Output Cost = (Output Tokens ÷ 1,000,000) × Price per 1M Output Tokens
Total Cost = Input Cost + Output Cost

Each cost term is computed from its own token count and its own per-million-token rate, then summed — mirroring exactly how usage-based API billing is itemized.

Where This Calculation Matters

  • Pre-launch cost modeling — before shipping a feature that calls the API, estimating what a representative request costs so total spend at expected usage volume can be projected.
  • Model tier tradeoffs — comparing a compact, lower-cost model against a larger flagship model on the same token counts to see the price gap in dollar terms, not just relative terms.
  • Reasoning-model budgeting — models built for extended reasoning can consume substantially more output tokens per response than a standard chat model, which this calculator makes concrete once you know the expected output length.
  • Usage anomaly checks — back-calculating expected cost for a known token volume and comparing it against an actual invoice line item to sanity-check billing.

Why the Model Selector Matters

The calculator's dropdown includes several current OpenAI model families with built-in per-model input/output rates, plus a "Custom Rate" option for entering your own pricing directly — useful for modeling a model not yet listed or a negotiated enterprise rate.

Note: OpenAI's published API pricing changes over time and varies across model families and context-length tiers. The rates built into this calculator are reference points, not a live feed — always confirm current pricing at openai.com/api/pricing before budgeting a production workload, or use the Custom Rate option with a rate you've verified yourself.

How to Use This Calculator

  1. Select a Model from the dropdown, or choose "Custom Rate" to enter your own pricing.
  2. If using Custom Rate, enter the Custom Input Price and Custom Output Price per 1M tokens.
  3. Enter the Input Tokens count for your request.
  4. Enter the Output Tokens count for the expected or actual response.
  5. Select Calculate for the total estimated cost, broken down by input and output.

Related Calculations

Need to estimate token counts first? Use the AI Token Calculator, or compare pricing against other providers with the Claude Token Cost Calculator and the Gemini Token Cost Calculator.