Claude API Costs vs OpenAI: Per-Token Math

Comparing claude api costs vs openai takes more than reading two price lists side by side, because the same job produces different token counts and a different input-to-output mix on each. Here is a repeatable per-token method, with a worked 1M-token example at $0.15 and $0.50 per 1M.

Last updated

Two precision scales weighing stacks of token coins with a ruler between them, illustrating a per-token cost comparison

Summary

  • Compare cost per finished task on the same workload, never rate against rate.
  • Count tokens with each API's own usage numbers because tokenizers differ.
  • The input to output mix can change the cost of 1M tokens by more than double.
  • Pull current rates from each vendor's pricing page; we do not quote them here.

Why a price list comparison misleads

Two pricing pages show you four numbers: an input and an output rate for each vendor. Put them side by side and you get a ranking that holds for exactly one workload, the one nobody in particular has. Real use is different in three ways.

  • The same prompt becomes a different number of tokens on each vendor, because each has its own tokenizer.
  • Models answer at different lengths. A more talkative model can cost more on output even at a lower rate.
  • Your mix of input and output decides which rate matters. A summariser mostly pays input rates, and a story generator mostly pays output rates.

So the method is to hold the workload fixed, measure tokens on each API, and price those measured tokens at each vendor's current rates. We are not quoting Anthropic's or OpenAI's numbers, because both change and we would be wrong by the time you read this. Both vendors' pricing pages are public. What we can do is show the math with our own rates as the worked reference.

The comparison in four steps

  1. Pick a representative workload. Thirty real requests from your product, including long ones.
  2. Run it on each API. Record prompt tokens and completion tokens for every call from the usage block.
  3. Price it. Cost = input tokens x input rate / 1M + output tokens x output rate / 1M.
  4. Adjust for quality. Divide the cost by the share of answers you can use as they are. A model that is usable 90% of the time costs about 1.11 times its raw price per usable answer.

Fill this table in for your own workload. The right-hand columns are the ones that matter.

ItemVendor AVendor BThis API
Input rate per 1Mcheck their current pricingcheck their current pricing$0.15
Output rate per 1Mcheck their current pricingcheck their current pricing$0.50
Measured input tokens, 30 requestsyour countyour countyour count
Measured output tokens, 30 requestsyour countyour countyour count
Usable answersyour scoreyour scoreyour score

A worked 1M-token example

Suppose a month of chat traffic totals 1M input tokens and 1M output tokens. At $0.15 per 1M input and $0.50 per 1M output, the cost is $0.15 + $0.50 = $0.65. If the other vendor charges twice our rates on both meters, the same traffic costs $1.30. If it charges ten times, $6.50. Since the rates are not ours to state for them, use the multiple that you find on their page.

Now see how much the mix matters. Keep the total at 1M tokens, and change the split.

Mix of 1M total tokensInput costOutput costTotal
900,000 in / 100,000 out (summaries, classification)$0.135$0.05$0.185
500,000 in / 500,000 out (chat)$0.075$0.25$0.325
200,000 in / 800,000 out (long generation)$0.03$0.40$0.43

The same million tokens costs $0.185 or $0.43 depending on direction, a ratio of 0.43 / 0.185, about 2.3. If a vendor's output rate is much higher than its input rate, a generation-heavy product pays far more than a summariser would. Compare vendors using your own mix, never the average.

Measure both APIs with one script

This script runs a list of prompts and prints measured tokens and cost for our endpoint. For another vendor, use their SDK and base URL in the same way, collect the same two counters, and apply their rates.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.claudeapicosts.com/v1",
    api_key="YOUR_KEY",
)

prompts = [
    "Summarise in two sentences: The quarterly report shows revenue up and costs flat.",
    "Draft a polite reply declining a meeting invitation.",
    "Write a 150-word product description for a steel water bottle.",
]

tin = tout = 0
for p in prompts:
    r = client.chat.completions.create(
        model="uncensored",
        messages=[{"role": "user", "content": p}],
    )
    tin += r.usage.prompt_tokens
    tout += r.usage.completion_tokens

print("input tokens:", tin, "output tokens:", tout)
print("cost at 0.15 / 0.50 per 1M: $%.6f" % (tin * 0.15 / 1e6 + tout * 0.50 / 1e6))

The usage block comes with every non-streamed response, and with streaming it arrives at the end of the stream. Use those figures instead of an offline token estimate when comparing.

Costs the rate card does not show

  • Retries and refusals. On this service, failed or refused requests are not charged. Check how each vendor handles them.
  • Caching and batch discounts. Some vendors discount repeated prompt prefixes or offline batch jobs. If your workload fits, the effective rate can be lower than the list rate. Read their current pricing for the rules.
  • Minimums and expiry. Here, top-ups run from $20 to $500 and credit never expires. Other plans can differ.
  • Rate limits. A full key allows 8 concurrent requests and 300 per minute. If your peak traffic is above that, the cheaper rate may not be usable.
  • Payment method. Top-ups here are crypto only, USDT on TRC20 or USDC on Base. If that does not suit you, the savings do not matter.

Mistakes that skew a vendor comparison

  • Comparing different model sizes. A small, fast model and a large reasoning model are different products. Compare models that you would genuinely choose between.
  • Mixing per-1,000 and per-1M rates. A rate of $0.00015 per 1,000 tokens is $0.15 per 1M. Convert first.
  • Ignoring the context ceiling. Here the window is 100,000 tokens. If a task needs more, cost is not the question.
  • Using one run. Output length varies. Run each prompt a few times and average.

Where this API fits in the comparison

This is neither Anthropic's API nor OpenAI's. It is an independent OpenAI-compatible service with one open-weight model, model ID uncensored, tuned to answer without content refusals for lawful adult use. It is text only, with a 100,000-token context window. Its value is a low per-token price, no subscription and a standard interface.

Be fair about where it loses. If you need a specific vendor's model, image or audio input, embeddings or the strongest reasoning available, compare on those needs first and cost second. If your workload is fiction, roleplay, companion apps or content that other providers refuse, the price and the lack of refusals together may decide it. Content involving minors is never allowed.

Switching code is small. Change the base URL to https://api.claudeapicosts.com/v1, the key, and the model to uncensored. The docs cover endpoints and parameters, and the pricing page lists rates and bonuses of +5% from $50, +10% from $100 and +15% from $200. For the longer cost background, see our analysis of uncensored LLM costs. To run the script above for free, claim the $0.50 trial on the API key page.

Common questions

Which is cheaper, Claude or OpenAI?

It depends on the model, your token mix and current rates. Measure tokens for your workload on each API and apply each vendor's current pricing.

Why do token counts differ between vendors?

Each vendor uses its own tokenizer, so the same text splits into a different number of tokens. Use each API's usage field.

Does this service offer Claude or OpenAI models?

No. It serves one independent open-weight model through an OpenAI-compatible API and is not affiliated with either vendor.

What does 1M tokens each way cost here?

1M input tokens cost $0.15 and 1M output tokens cost $0.50, so $0.65 for both.

Get your API key in minutes

Sign up, copy the key, update your base URL. That’s it.

Start now