LLM token and cost calculator
Paste a prompt or enter a word count, add the expected answer length and the number of requests, and type in your model's prices per million input and output tokens. You get the tokens per request, the cost of one request and the total.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Choose where the input size comes from: paste the prompt text, enter a word count, or enter tokens if you know them.
- Enter the expected length of the answer in tokens and how many requests you plan.
- Type in the input and output prices per million tokens from your provider’s price list.
- Read the total cost, the cost of one request and the token counts.
How it works
- Text: tokens ≈ characters ÷ characters per token, rounded up. Four characters per token is a common estimate for English.
- Word count: tokens ≈ words × 4/3, the same rule written for words (100 tokens ≈ 75 words).
- Cost of one request = input tokens × input price ÷ 1,000,000 + output tokens × output price ÷ 1,000,000.
- Total = cost of one request × number of requests.
Example
A prompt of 750 words with 500 output tokens, 1,000 requests, input at 2 and output at 8 per million tokens:
- Input: 750 × 4/3 = 1,000 tokens.
- One request: 1,000 × 2 ÷ 1,000,000 = 0.002 for input + 500 × 8 ÷ 1,000,000 = 0.004 for output = 0.006.
- Total: 0.006 × 1,000 = 6.00, for 1,500,000 tokens.
Tips
- Include the system prompt, instructions and any documents you attach: they are input tokens on every request.
- Set a maximum answer length in your API calls so output costs cannot run away.
- Check the result against the usage figures of a few real requests and adjust the characters-per-token value.
Frequently asked questions
How accurate is the token estimate?
It is a rule of thumb. Each model splits text with its own tokenizer, so the real count can differ by a noticeable margin, especially for languages other than English, code and numbers. For billing to the cent, use the token counts your provider reports for real requests.
Why are input and output priced separately?
Most providers charge more for generated tokens than for the tokens you send. That is why the calculator asks for the expected answer length separately and shows the input and output parts of each request.
Why do other languages need more tokens?
Tokenizers are trained mostly on English text, so common English words are often one token, while words in other scripts are split into more pieces. Lower the characters-per-token value to account for that.
Does a chat history count again with every message?
Usually yes: in a chat API each request sends the whole conversation so far, so input tokens grow with every turn. Enter the average prompt size including history to estimate a long chat.
Which prices does the tool use?
Only the ones you type. Prices differ between models and change over time, so the calculator has none built in.