Costs & pricing

AI API Pricing Explained: Input, Output, Caching and Hidden Costs

THE SHORT ANSWER

Most text AI APIs charge separately for input and output tokens. Some also distinguish cached input, cache writes, reasoning, tools or service tiers. To estimate a bill, multiply each billable category by its own rate and add the results. A single “price per million tokens” is incomplete unless it specifies the category.

What are input and output tokens?

Input includes the content sent to the model: instructions, messages, retrieved documents and tool definitions. Output is what the model generates under the provider’s billing rules. Tokenization varies by model and content, so character or word counts are only rough planning aids.

Conversation history can be sent repeatedly. A ten-message conversation is not necessarily billed as ten isolated messages; later requests may include the earlier context again.

How do you calculate a basic request cost?

Use this formula when there are only uncached input and output charges:

Request cost = input tokens / 1,000,000 × input rate + output tokens / 1,000,000 × output rate.

For a hypothetical model charging $1 for input and $5 for output, a request with 2,000 input and 500 output tokens costs $0.0045. At 100,000 identical requests, the token bill is $450. These rates are an arithmetic example, not a provider quote.

A model with cheaper input can still cost more for long answers. Always compare the combined workload.

How does cached input change the calculation?

Split regular input, cache reads and cache writes according to the provider’s definitions. Some usage fields represent subsets of a total; others represent separate categories. Understand that relationship before summing them.

For a hypothetical request with 10,000 total input tokens, including 8,000 cache reads, do not charge 10,000 regular tokens plus 8,000 cached tokens if the cached portion is already included in the total. Charge the appropriate 2,000 and 8,000 categories instead.

What other charges can appear?

Reasoning may consume billable output even when it is not visible as ordinary answer text. Tools such as web search can have separate units. Image, audio and video generation may use per-image, per-second or task-based prices. Platform fees and taxes can sit outside inference rates.

A failed client request may also have reached the provider. Reconcile actual usage rather than assuming every timeout costs nothing.

Why does the balance sometimes fall before completion?

Some services reserve an estimated amount before beginning work, then settle against actual usage. A reservation is not necessarily the final charge. Tokely documents output reservations and usage settlement in its billing guide.

How should you compare services?

Use the exact model, endpoint, context tier, cache assumptions and workload. State the date and currency. Keep price calculations separate from performance claims.

For current Tokely rates, use the pricing page. For a monthly forecast that includes multiple calls per feature, continue with the AI API cost calculator guide.

More clarity. Better decisions.Back to top ↑
PUT IT INTO PRACTICE

Find your model.
Make your next move.

Compare current prices, choose a model, and build with one API.