Token cost calculator

Token Cost Calculator

Calculate how input tokens, cached input tokens, and output tokens contribute to the cost of each AI API request.

Price requests from token components

Token cost is not one blended number. Many providers price input and output tokens separately, and some offer lower cached-input pricing for repeated prompt or context segments. This page focuses on the cost mechanics behind each request.

Calculator shortcut

Use the calculator with provider and model pricing to estimate input, cached input, output, and monthly cost.

Calculate token costs

Benefits

Input cost clarity

Estimate the cost of instructions, user text, chat history, and retrieved context.

Output cost planning

Model how generated answer length affects cost when output tokens carry a higher unit price.

Cached-input awareness

Account for cached input pricing where providers support discounted repeated context.

Providers and guides

Keep the calculator close to the source material: compare provider pages, then use short guides to refine token and usage assumptions.

Use cases

Per-request cost checks

Estimate one average request before multiplying it across traffic.

Prompt optimization

Measure how shorter instructions or smaller context windows can reduce input-token cost.

Response limits

Compare concise and verbose output settings before setting product defaults.

Pricing estimation warning

Provider pricing can change and may include special tiers, batch discounts, or terms not captured by a simple calculator.

Launch checklist

Make the estimate more useful

A few practical checks help developers and founders avoid surprises after real users arrive.

Common cost mistakes

Forgetting retries, long context, power users, and generated output length.

How to reduce AI API costs

Shorten prompts, cap output length, cache repeated answers, and route simple tasks to cheaper models.

Cheaper vs stronger models

Use stronger models when accuracy or reasoning changes the outcome; use cheaper models for routine work.

Before launching an AI feature

Ask who triggers requests, how often, how long responses are, and what happens during usage spikes.

Related calculators

FAQ

How are AI API costs calculated?

Most AI API estimates multiply input tokens, output tokens, and request volume by the selected model's token prices.

Why are output tokens more expensive?

Output tokens often cost more because the model is generating new text, which usually requires more inference work than reading input context.

What are cached input tokens?

Cached input tokens are repeated prompt or context tokens that some providers can reuse at a discounted price.