DataHubFinance Tools AI API Cost Calculator

AI & Hosting Costs

AI API Cost Calculator

Estimate AI API usage cost from input tokens, output tokens, and per-million token prices.

Cost = Input tokens / 1M × input price + Output tokens / 1M × output price

What this calculator does

Estimate one text-token workload cost from input and output token counts and user-entered prices per million tokens.

Scope, period, and currency

This page runs a local formula from user-entered values. The country/currency selector changes money symbols and formatting only: it does not perform live or historical FX conversion or automatically change contract, tax, accounting, or regulatory rules. Convert all amounts into one currency first and keep periods and metric definitions consistent.

Formula variables

Tᵢ/Tₒ
Input and output tokens for one defined workload period.
Pᵢ/Pₒ
Input and output price per one million tokens.

Formula and worked example

Formula: Cost = Tᵢ ÷ 1,000,000 × Pᵢ + Tₒ ÷ 1,000,000 × Pₒ.

Recalculation: 12 million input tokens at $1.25/M plus 2.6 million output tokens at $10/M = $15 + $26 = $41 for that workload.

Model assumptions

  • Token counts and prices cover the same model, tier, and workload period.
  • Caching, Batch, long-context tiers, reasoning, images, audio, tools, search, and taxes are excluded unless added manually.
  • The result covers exactly the workload period entered and is not automatically multiplied into a daily or monthly forecast.

Reading the result and model boundary

  • Output tokens can dominate cost when their unit price is higher.
  • Always recheck provider pricing because models and price tiers change.

This is a fixed text-token price model, not a complete provider invoice estimator.

How to use it

  1. Define whether token counts are per request, batch, day, or month.
  2. Copy the current prices for the exact model and tier.
  3. Calculate the workload cost and add excluded billable features separately.

Common incorrect uses

  • Leaving the workload period undefined.
  • Ignoring cached-input or Batch discounts and special token classes.
  • Changing the currency symbol without converting provider USD prices.

Suggested verification workflow

  1. Fix model, tier, and period.
  2. Calculate text-token cost.
  3. Reconcile with provider billing and excluded features.

FAQ

What period do token counts represent?

Whatever request, batch, day, or month you define; the page does not multiply it into another period.

Are cache, tools, images, or search included?

No. Add provider-specific charges separately.

Does currency selection convert provider prices?

No. It changes formatting only; convert prices yourself before entry if needed.

Method and review boundary

Results are calculated locally in the browser from the formula shown on this page. The tool does not retrieve live rates, quotes, approvals, or billing data. Last reviewed: July 24, 2026.

Use the result for first-pass estimates, scenario comparison, and question preparation; it is not financial, investment, tax, accounting, or legal advice.

Authoritative sources and notes

Sources checked July 24, 2026. Rates, product rules, and official guidance can change; verify them again before a formal decision.