TokenRate
Guide · Fundamentals3 min read

Tokens to Dollars: Calculate an AI API Request

A worked input and output token calculation, with the billing categories that a simple token converter cannot include.

By TokenRate · Published · Updated

TL;DR

Multiply input tokens by the input price, output tokens by the output price, then divide each by one million and add them. A single total token count cannot give an exact bill when input and output have different rates.

Start with the usage record

Your API response or provider dashboard should report input and output usage separately. Input includes instructions, the current message and any conversation history sent again. Output includes generated text and, for some models, reasoning tokens. A total token count hides the split, so a precise cost calculation starts with both counts.

Use the formula

USD = (input tokens × input price per million + output tokens × output price per million) ÷ 1,000,000. For example, assume 2,000 input tokens at $3 per million and 500 output tokens at $15 per million. Input costs $0.006; output costs $0.0075; the request costs $0.0135. These are illustrative rates, not a quote for a named model.

Scale a request into a budget

At 10,000 identical requests, the example costs $135 before discounts or other billable services. Use real usage samples, not only a best-case prompt. Conversation history can grow on later turns, and retries increase the number of requests. For a monthly forecast, multiply each observed token class by expected monthly request count before applying its rate.

Check billing exceptions

Provider price pages may list separate rates for cached input, batch processing, long context, images, audio, tool calls and service tiers. A text-token estimate omits those categories. Check the exact model ID, route and billing date on the provider's price page before treating an estimate as an invoice. Open the Tokens to USD calculator for current catalog rates and separate input/output entry.

Primary sources

Frequently Asked Questions

Can I convert one million tokens into one fixed dollar amount?

No. The amount depends on the model, provider, input/output mix and any special billing categories.

Are reasoning tokens free?

Usually not. Check the provider's usage record and pricing rules. When reasoning is already included in reported output tokens, do not add it again.

Try the TokenRate Calculator

Use the TokenRate tools to calculate cost from your own usage and the current model rates.

Open Calculator →