Skip to content

Tokens and costs

What are AI tokens and how do you calculate their cost?

Two short messages can have different costs. A model may process instructions, conversation history and retrieved documents as well as the latest question. Here is what to count and how to budget for it.

A token is a unit a language model processes

A token can represent a whole word, part of a word, punctuation or another text fragment. A tokenizer converts text into a sequence of these units before the model processes it. Word counts, character counts and token counts therefore measure different things.

Different models may tokenize the same Russian or English text differently. Language, vocabulary, numbers, code and special characters all affect the result. A rule such as “one token is four characters” is only a rough approximation in some cases. For budgeting, use the selected provider's tokenizer or token-counting method, then check the actual usage returned by the API.

A token allowance is different from a context window. A context limit describes how much information a model can process in a request. A token balance describes available service usage. A larger balance does not increase the model's context window.

What consumes tokens in an AI assistant?

A request has input and output. The input may include assistant instructions, the customer's question, conversation history and knowledge-base excerpts. The output is the generated response. A short customer message can therefore produce a much larger model request.

Components of a text request
ComponentWhat it containsWhat to check
Input tokensInstructions, history, a question and retrieved document excerptsHow much text is actually sent on each turn
Output tokensThe generated reply; some models also account for reasoning tokensThe output limit and the model's billing rules
Additional callsA separate conversation summary or another generation attemptHow many model requests a customer scenario needs

In a longer conversation, history may be included again in later requests. Five customer messages do not necessarily mean five equal costs. Caching can change the price of repeated content when the provider supports it and the integration uses it.

How to calculate token costs

If input and output are priced separately, the basic cost of one request is:

Cost = (input_tokens × input_price + output_tokens × output_price) / 1,000,000

Both prices must be per million tokens and in the same currency. If a provider quotes prices per thousand tokens, divide by 1,000 instead, or convert both rates to prices per million first.

An illustrative example: a request uses 1,000 input tokens and 500 output tokens. At rates of USD 2 and USD 8 per million respectively, input costs USD 0.002 and output costs USD 0.004. The request totals USD 0.006; one hundred identical requests cost USD 0.60. These are example rates, not current prices for a particular model.

For a production budget, add separately priced cached tokens, tools and other operations where applicable. Include retries, changing conversation history and any relevant taxes. Applying one rate to all tokens gives the wrong result when input and output prices differ.

LLM cost calculator

Enter your model's actual rates and the average usage per request. For a mix of conversations, first measure several representative scenarios: a short FAQ, a longer consultation and an enquiry that searches a knowledge base.

Estimate API request costs

One request: 0.006 USD

All requests: 0.60 USD

Total tokens: 150,000

Rates of 2 and 8 are illustrative, not AIVANT or provider prices. Enter rates for your model. This calculator excludes caching, separately priced reasoning, tools, taxes and currency conversion.

What can you do with 50,000 tokens?

AIVANT's free plan provides 50,000 tokens to explore the service. This is a usage allowance, not a fixed number of messages. Check the plan duration and available features in your account.

If a generation uses 1,000 input tokens and 500 output tokens, the arithmetic estimate is around 33 such generations with an unchanged context length. Actual usage depends on instructions, history, documents and additional model calls. This is not a promised number of customer conversations.

API costs and AIVANT plan prices are separate. This calculator estimates API requests using the rates you enter. It does not calculate an AIVANT subscription price. AIVANT accounts for input plus output tokens, including separate summary calls; plan prices and top-up terms are shown in the account.

How to reduce usage while keeping answers useful

  • Remove repeated instructions. Clear rules are more useful than multiple versions of the same sentence.
  • Retrieve relevant document excerpts rather than sending an entire company archive with every request.
  • Match answer length to the task. Asking for a phone number does not require a page-long reply.
  • Review how history is stored and sent, and when a summary is needed.
  • Compare the cost of a successfully completed scenario rather than the token price alone. Repeated attempts have a cost too.

Use the same customer questions for each test and measure quality alongside consumption. See our guide to the differences between LLM families when selecting a model.

Common questions

Can I calculate tokens exactly from character counts?

No universal conversion exists. The result depends on the tokenizer and the full request. Even a preliminary count may differ from final API usage because of additional request formatting.

Does Russian always use more tokens than English?

There is no rule that applies to every text and tokenizer. Measure the actual examples with the model you intend to use. Counts from one model cannot be applied to every other model.

Are tokens free when the answer is wrong?

Answer quality and billing are separate. A provider may charge for a completed generation regardless of whether its contents are useful. Check the service's rules for failed requests, retries and refunds.

Documentation to consult

Checked on October 4, 2026. Verify the prices and billing rules of your selected model before preparing a budget.

Related guides