EN ▾
Try with trial credit

OpenAI API Pricing Calculator: Estimate Monthly Cost

An OpenAI API pricing calculator is just one formula and three inputs: how many requests, how many tokens each way, and the two rates. Here is how to build it in a sheet or in code, and how the result changes at $0.15 and $0.50 per 1M tokens.

Last updated

A glass abacus with glowing beads and sliders estimating a monthly cost

Summary

  • You need requests per month, average input tokens, average output tokens and two rates.
  • Take current OpenAI rates from its pricing page; the formula stays the same.
  • Add 20% headroom for retries, longer replies and growth.
  • The same traffic on our API is a quick substitution.

The formula behind every calculator

Online calculators hide the maths, but it is always this:

monthly = requests x ( in_tokens x in_rate + out_tokens x out_rate ) / 1,000,000

Inputs: requests is how many API calls you make per month; in_tokens and out_tokens are the averages per call; the rates are dollars per million tokens for the model you chose. OpenAI changes its model list and prices, so copy the rates from its current pricing page. This article uses our own rates for worked numbers because we can state those with certainty.

Step 1: collect your three numbers

  1. Requests per month. Active users x sessions x calls per session. Be explicit about the guess.
  2. Average input tokens. System prompt + history + pasted content + tool definitions.
  3. Average output tokens. Look at real replies, not the maximum you allow.

If you already have an app running, the API returns token usage in each response, so log it for a few days and average. If you do not, write down five typical prompts, paste them into a tokenizer tool and estimate. Roughly 1,000 tokens equal 750 English words.

If you are designing a new product and have no logs yet, run the calculator three times: a low case, an expected case and a high case. Use different values for all three inputs, changing more than the request count. The spread between low and high tells you how much a decision rides on guesses, and it shows which input is worth measuring first.

Step 2: build it in a sheet

Put the inputs in cells and use one line of formula. In a spreadsheet:

  • B1 requests per month, B2 average input tokens, B3 average output tokens
  • B4 input rate per 1M, B5 output rate per 1M
  • B6: =B1*(B2*B4+B3*B5)/1000000

Add a column per provider by changing only B4 and B5. That is a calculator with a comparison built in.

Or in a few lines of code

from openai import OpenAI

def monthly_cost(requests, tokens_in, tokens_out, rate_in, rate_out):
    return requests * (tokens_in * rate_in + tokens_out * rate_out) / 1_000_000

# Our rates: $0.15 in, $0.50 out per 1M tokens
print(monthly_cost(20_000, 1_500, 250, 0.15, 0.50))  # 7.0

# Measure real token counts to feed the function
client = OpenAI(base_url="https://api.pricingapiopenai.com/v1", api_key="YOUR_KEY")
r = client.chat.completions.create(model="uncensored", messages=[{"role": "user", "content": "Hi"}])
print(r.usage.prompt_tokens, r.usage.completion_tokens)

Many people build the sheet once and never touch it again. Better to treat it as a living file: paste a fresh week of averages each month, and note which assumption changed. After a quarter you will have a record of how your token usage drifts as features ship, and that drift is usually the biggest source of forecast error.

Three worked examples at $0.15 / $0.50

WorkloadRequestsIn / out per callMonthly cost
Support bot20,0001,500 / 250$7.00
Content tool3,000800 / 1,500$2.61
Document analysis2,00030,000 / 800$9.80

The support bot: 30M input tokens x $0.15 = $4.50, plus 5M output tokens x $0.50 = $2.50, total $7.00. The content tool: 2.4M input = $0.36, plus 4.5M output = $2.25, total $2.61. Document analysis: 60M input = $9.00, plus 1.6M output = $0.80, total $9.80.

Feed the same three rows through OpenAI's current rates for the model you are considering. The gap, in whichever direction, is your answer for these workloads.

Sizing a pilot

For a pilot, you usually care about the worst case, not the average. Estimate peak requests per day, multiply by 30, and use the high end of your token range. If the pilot has 500 users sending 20 requests a day with 2,000 input and 400 output tokens, that is 300,000 requests a month. At our rates, input is 600M tokens x $0.15 = $90.00 and output is 120M x $0.50 = $60.00, for $150.00.

That figure is your ceiling. If you set a per-user daily request cap, the ceiling is enforced by code and not by hope. The pilot then costs at most $150 a month even if every user maxes out, which is a number a budget owner can sign.

Add headroom and track real spend

Calculators give a forecast, not a promise. Multiply by 1.2 to leave room for longer replies, retries and growth. The support bot becomes $8.40 in the budget.

After launch, compare estimate with actuals weekly. On this API, each response carries an X-Balance-USD header, and you can read your balance with GET /v1/balance, so spend is easy to watch from code. A big gap between forecast and actual usually means history is growing or output replies are longer than you assumed.

Top-ups start at $20 in any whole amount to $500, in crypto, with bonus credit of 5% from $50, 10% from $100 and 15% from $200. Credit never expires, so there is no wasted month. Details are on the pricing page.

Common calculator mistakes

  • Using the maximum output length. The cap you set is not the average. Use real replies.
  • Forgetting the system prompt. A 1,000-token prompt on 100,000 requests is 100M input tokens. At our rate that is $15.00 you did not see.
  • Treating chat as stateless. Each turn resends history, so input grows with conversation length.
  • Using one model for everything. If you route easy tasks to a small model, calculate each route separately and add them up.
  • Mixing units. Rates are per million tokens; token counts are usually per thousand. Convert once and label the cells.

Put a column called "source" next to each input and write where the number came from: logs, a guess, or a vendor page. That column is more valuable than the formula when someone challenges the total.

A request-volume sanity check

Before you trust the output, run a reverse check: divide the total by the number of requests and see if the per-request figure is plausible. The support bot above comes to $7.00 / 20,000 = $0.00035 per request. For 1,500 input and 250 output tokens, you can verify by hand: $0.000225 plus $0.000125 is $0.00035. If the sheet gave you a tenth of that or ten times that, a unit is wrong.

Also convert to what a top-up buys. A $20 top-up covers about 57,000 support-bot requests, since $20 / $0.00035 is 57,142. That tells you how long a single purchase lasts at your traffic.

Switching the same code to this API

If your app uses an OpenAI SDK, the move is two settings and a model name. This API is OpenAI-compatible but runs one open-weight model, uncensored, from an independent provider. It is not an OpenAI product, and quality will differ, so test it on your prompts first.

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.pricingapiopenai.com/v1",
  apiKey: process.env.API_KEY,
});

const r = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(r.choices[0].message.content, r.usage);

Get a key on the API key page. The Claude-focused pricing comparison works the same method for another vendor, and the docs cover limits: a full key allows 8 concurrent requests and 300 per minute.

Common questions

How do I calculate my OpenAI API bill?

Multiply requests per month by average input tokens times the input rate plus average output tokens times the output rate, then divide by one million.

Where do I get current OpenAI rates?

From OpenAI's own pricing page. Rates and model names change, so we do not quote them here.

What would 20,000 support-bot requests cost here?

With 1,500 input and 250 output tokens each, $7.00 a month at $0.15 and $0.50 per 1M tokens.

Can I use the OpenAI SDK with this API?

Yes. Set the base URL to https://api.pricingapiopenai.com/v1, use your key and set the model to uncensored.

Get your key in minutes

Register, grab the key, update the base URL. Simple.

Start with free credit

Email and password. Key displayed immediately.