Trending Hot

Interactive cost model

AI Inference Cost Calculator: API vs Self-Hosted GPU

Use your own workload and price inputs to compare token-priced APIs with a self-hosted GPU service. Every formula is visible and provider-neutral.

Primary query: AI inference cost calculatorIntent: toolLast verified: 2026-09-09

Editorial verdict

Use the calculator as a screening model, then replace every default with a measured value from your bill or load test. API pricing usually fits variable demand; self-hosting becomes credible only when utilization is sustained and operations are included.

Best for: Engineering and finance teams estimating inference unit economics

Editable model

AI inference cost calculator

Defaults are examples, not live provider quotes. Replace them with current official prices and measured throughput.

Token-priced API

Estimated monthly API cost

$48

Self-hosted GPU hardware

Hardware / month

$2,190

Hardware / 1M output

$3.33

At the API scenario's output volume, modeled GPU hardware is $100. This excludes CPU, storage, networking, redundancy, orchestration and labor.

Inputs that most change the answer

InputWhy it mattersHow to verify
Input/output token mixOutput tokens are often priced differentlyMeasure production request logs
Cache hit rateReusable input may receive a discount or avoid computeObserve cache metrics, not assumptions
GPU utilizationIdle hardware still costs moneyUse a week of fleet telemetry
Sustained throughputConverts hourly GPU cost into token costLoad-test the exact model and engine
Operations overheadOn-call, orchestration and failures are real costsAdd labor and platform allocation separately

The API cost formula

Monthly API cost equals request volume multiplied by the average uncached input, discounted cached input and output token charges. Prices in the calculator are dollars per one million tokens. The defaults are neutral examples, not a quote from any provider.

Caching only changes the result when the provider offers a cached-input price or your own stack avoids repeated prefill. Enter the observed share of eligible input and the actual discount. A claimed cache rate without production evidence can make a cost model look much better than the bill.

The self-hosted cost formula

The calculator estimates monthly hardware cost from GPU count, hourly price and active hours. It estimates output capacity from measured output tokens per second, utilization and active seconds. Dividing cost by delivered tokens produces a hardware-only cost per million output tokens.

This intentionally does not hide software engineering, networking, storage, observability, failed capacity or model-quality work inside the number. Add those costs before making a purchasing decision. For bursty traffic, the utilization assumption is usually the most sensitive variable.

How to use the result

Treat a result within 20 percent as a tie until you have a production-shaped load test. Prefer the option with lower operational risk and better scaling behavior. If self-hosting only wins at nearly perfect utilization, it is not yet a robust economic win.

Recalculate when prompt length, model size, provider price, cache policy or latency target changes. Preserve each scenario with its date and assumptions so future comparisons remain auditable.

Implementation checklist

  1. 1Enter monthly requests and measured average input/output tokens.
  2. 2Copy current API prices from the provider's official pricing page.
  3. 3Enter cache eligibility and discount only when verified.
  4. 4Load-test self-hosted throughput at the required latency SLO.
  5. 5Add staffing and platform overhead outside the hardware-only result.

Frequently asked questions

How do you calculate AI inference cost?

For an API, multiply monthly input and output tokens by their current per-token prices, then apply any verified cached-input discount. For self-hosting, divide total GPU cost by the number of tokens delivered at measured utilization.

Does the calculator use live provider prices?

No. Prices change, so the calculator is provider-neutral and requires editable inputs. Copy current figures from the provider's official pricing page before relying on the result.

When is self-hosted inference cheaper?

Usually when demand is predictable enough to keep the fleet well utilized, the team can operate the stack efficiently, and measured throughput meets the latency target. Hardware-only savings are not sufficient if operations erase them.

Official sources and methodology

Capability claims are anchored to official project or provider documentation. Prices, models and benchmark rankings can change; verify current terms and test the exact workload before purchasing.

Editorial disclosure: this Phase 1 cluster contains no affiliate links. Future commercial relationships must not change rankings or evaluation criteria.

Continue the inference cluster

Read the underlying AI inference optimization signal →