keepcalculator

06 Numbers and Powers

OpenAI vs Anthropic API Pricing: Compare Total Costs

Card No. 06·37045 · Updated · Standard formula, shown below

To compare OpenAI and Anthropic API pricing, estimate the same workload with each provider’s current model rates, then add costs for input tokens, output tokens, tools, caching, and any related infrastructure. The cheapest rate per million tokens is not necessarily the cheapest API: model choice, prompt size, answer length, and task quality all affect the total.

Start with a like-for-like workload

Before comparing prices, define what the API will do. A short classification request, a coding assistant, and a long-document summarizer have different token patterns and may need different model capabilities. Choose equivalent models based on the work they can reliably perform, rather than comparing providers’ most expensive models by default or treating model names as direct equivalents.

Record the workload in measurable terms:

  • Requests per day or month.
  • Average input tokens per request, including system instructions, conversation history, and supplied documents.
  • Average output tokens, including reasoning or other generated content when it is billable under the model’s current terms.
  • How often prompts or context repeat and might qualify for a provider’s caching features.
  • Whether requests use image, audio, video, web search, code execution, or other tools.
  • Quality requirements, such as accuracy, latency, structured output, or ability to handle long context.

Use measured usage from a representative test when possible. Token counts are not the same as word counts; text, code, languages, and tokenization all affect the number. For multimodal requests, the input may be billed in a format-specific way, so a plain-text estimate alone can miss a material cost.

How API charges are usually calculated

For a standard text request, a useful first-pass formula is:

Estimated cost = (input tokens ÷ 1,000,000 × input rate) + (output tokens ÷ 1,000,000 × output rate)

Apply the rates for the exact model and pricing unit shown in the provider’s current pricing documentation. Rates can differ for input and output tokens. Some models or features may also distinguish cached input, batch processing, or other usage categories; treat each as a separate line item and apply its eligibility rules rather than assuming it receives a discount.

For monthly usage, calculate per-request cost and multiply by the expected number of requests, or calculate total monthly input and output tokens directly. Keep input and output separate: a system with modest prompts but very long answers can be output-heavy, while document analysis may be input-heavy. If you combine all tokens into one total and use one rate, the estimate can be substantially wrong.

Build a total-cost comparison

Create one row per candidate model and include all charges tied to the use case. A practical comparison should cover:

  • Base token use: input and output tokens at the model’s applicable rates.
  • Repeated context: cache reads or writes where supported, including any different pricing and cache-duration rules.
  • Tools and modalities: charges for hosted search, code execution, images, audio, or other tools, plus any separate usage fees that apply.
  • Retries and failures: tokens consumed by retries, timeouts, invalid outputs, or quality checks. Do not assume a failed application request used no billable API resources.
  • Operational overhead: your own storage, orchestration, monitoring, network, and engineering costs. These are not necessarily provider API charges, but matter to the system’s total cost.
  • Discounts and commitments: include only discounts or contractual terms that actually apply to your account and usage pattern.

Keep provider-billed charges separate from internal costs, then show both a monthly total and cost per successful task. The latter is often more meaningful: a model that costs more per call may need fewer retries or human corrections. Conversely, do not assume a more capable model will reduce work unless a pilot demonstrates it.

Worked example with hypothetical rates

Suppose a service makes 100,000 requests in a month. Each request averages 2,000 input tokens and 500 output tokens. That is 200 million input tokens and 50 million output tokens. To illustrate the arithmetic only, assume one candidate’s rates are $2 per million input tokens and $8 per million output tokens, while another’s are $3 and $6. These are hypothetical figures, not current OpenAI or Anthropic prices.

  • Candidate A: 200 × $2 + 50 × $8 = $800.
  • Candidate B: 200 × $3 + 50 × $6 = $900.

Candidate A is cheaper for this particular token mix. But if output volume were lower, or if eligible caching, tool usage, or model performance differed, the result could change. Substitute the current published rates, measured token counts, and applicable feature charges before making a decision. Check whether the pricing page quotes per token, per million tokens, or another unit, and convert carefully.

Compare model fit, not just rate cards

OpenAI and Anthropic offer multiple models and API features, and their catalogs and prices can change. A fair comparison therefore names the exact model and feature configuration, not just the provider. Test candidates on representative prompts and score the outputs against the task’s requirements: correctness, completeness, format compliance, refusal behavior where relevant, and response time.

Estimate cost per acceptable result as well as cost per request. For example, if one model produces a valid structured response more often, its reduced retry rate might offset a higher token price. Include human review when it is part of the real workflow. Use the same evaluation set and acceptance criteria for both providers to avoid favoring a model based on a few memorable examples.

Common estimation mistakes

  • Using an outdated rate: model pricing and available options can change. Check official provider pricing pages immediately before estimating or deploying.
  • Ignoring conversation history: if the application sends prior turns on each request, input tokens may grow over a session.
  • Assuming every token has one price: input, output, cached, and feature-specific usage may have separate rates.
  • Comparing different workloads: different prompts, output limits, tools, or quality thresholds make the result unreliable.
  • Confusing token cost with total system cost: API bills do not include every application, staffing, or infrastructure expense.
  • Relying on a single average: long-tail requests can use far more tokens than typical ones. Examine percentiles and peak usage as well as the mean.

For a robust forecast, run a pilot, capture usage by model and feature, and calculate low, expected, and high scenarios. Revisit the estimate after prompt changes or model upgrades, since either can alter token counts, quality, and retry rates.

Frequently Asked Questions

Is OpenAI or Anthropic cheaper for API use?
Neither is always cheaper. The answer depends on the specific models, input-to-output token mix, caching eligibility, tools, and how much rework a model requires. Compare current rates against the same measured workload.

How do I compare cost per million tokens?
Multiply input and output tokens separately by their respective per-million rates, then divide each token count by one million. Add applicable feature or cached-token charges as separate items.

Do API prices include web search or other tools?
Not necessarily. Tool use may have separate charges or usage rules. Check the current documentation for the specific model and tool, and include both tool charges and any tokens generated around tool calls.

Does prompt caching always lower the bill?
No. Caching applies only when the provider’s eligibility conditions are met, and cached reads or writes may have their own prices and duration rules. Estimate savings using the actual repeated prompt volume and current terms.

How can I estimate monthly API spend accurately?
Measure representative requests, separate input and output tokens, account for tools and retries, and multiply by realistic monthly volume. Use a range for unusually long requests and verify the estimate against actual billing during a pilot.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →