Converter tool

LLM Token and API Cost Estimator

Estimate how many tokens a prompt or text file holds and what a run of API requests would cost at the prices you type, with expected output, cached input, a batch discount and a context window check.

Your text and the figures you type are held in this page's state while it is open and counted there. A reload starts over with an empty text box, and the estimator transmits none of it.

Input tokens per request

Prices and usage

No prices are built in: they differ between providers and models and change over time. Copy them from your provider's current price page. Costs below are in the same currency as the prices you type.

Preview

Output Preview

Text

Characters
0
Words
0
Chinese, Japanese, Korean characters
0
Estimated tokens
0 tokens

Estimated from characters and words: about 4 characters or 0.75 words per token for most languages, and about 1 token per Chinese, Japanese or Korean character. Real counts depend on the model's tokenizer.

Cost

Type the input price and output price to see costs.

Context window

Type the context window size to check whether the input plus the expected output fits in one request.

LLM Token and API Cost Estimator

Operator: Abdulla Al Fahad. How tools are built and checked

Before a model goes into a batch job or a customer-facing feature, someone asks what it will cost. The arithmetic is only a few multiplications, yet it is easy to be off by a factor of a thousand: prices are quoted per million tokens, requests are counted in thousands, and the reply is usually billed at a different rate from the prompt. Paste the prompt you plan to send, or open it as a text file, type the prices from your provider's price page, say how long the replies will be and how many requests you expect, and the page works out the cost of one request and of the whole run.

The token count is an estimate, shown as a low-to-high range, because every model family splits text with its own tokenizer. Each cost is worked out at the low end, the middle and the high end of that range, so the uncertainty stays visible instead of hiding behind one confident figure. If you already have a measured input count, such as the figure in a provider's usage report, type it instead and the range narrows to that number.

Key features

  • Character, word and Chinese, Japanese and Korean character counts
  • Estimated input tokens as a range, with the method shown beside it
  • Or a token count you type, such as a measured figure from a usage report
  • Input and output prices per 1 million tokens, typed by you, with no built-in price list
  • Expected output as a fixed number of tokens or as a ratio of the input
  • Number of requests, an optional cached share of input with its own price, and an optional batch discount
  • Cost per request and in total, at the low, middle and high token estimate
  • Context window check, with the number of parts needed when the input does not fit
  • Copyable summary and a CSV download

How prices are read and estimates exported

Text can be typed, pasted or loaded from a .txt, .md, .json or .csv file of up to 10 MB. Loaded files are decoded as UTF-8, switch to UTF-16 when their first two bytes are a byte-order mark, and drop back to Windows-1252 if the UTF-8 reading fails. A Word document or another ZIP-based file, a PDF, or anything else with binary content is refused with a note telling you to paste its text. A loaded file longer than 300,000 characters is counted in full but not shown in the text box, to keep typing in the box responsive.

Prices are per 1 million tokens, in whatever currency you use, and every cost on the page is in that same currency. Type them as plain numbers such as 3, 3.00 or 0.075. A dot on its own is a decimal point, so 1.500 is one and a half. Commas that split the digits into groups of three after a leading 1 to 9, as in 1,250 or 20,000, are thousands separators, and so are the dots in 1.250,50, where the last comma is the decimal mark. Any other single comma is a decimal comma: 3,5 is three and a half, and 0,075 is the same as 0.075, because a leading 0 is never followed by a thousands separator. Whenever a field holds a comma, the number it was read as appears under it without separators, so 1,500 shows as 1500; if you meant one and a half, type 1,5 or 1.5 instead. Currency signs and letters are rejected with a message under the field.

Copy summary puts a plain-text report on the clipboard: the text statistics, the token range, every setting you typed, the cost per request and in total, the context check and the estimation method. Download CSV saves token-cost-estimate.csv with the columns Item, Low, Estimate and High, one row per figure, plus the prices and settings used, so the estimate can be pasted into a budget sheet and checked later.

How it works

Tokens are estimated two ways and averaged. Outside Chinese, Japanese and Korean text, one estimate allows about four characters per token and the other about four tokens for every three words; each Chinese, Japanese or Korean character counts as one token in both. The range runs from 15 percent below the lower estimate to 15 percent above the higher one. The same rule of thumb is printed beside the token figure on the page, and the summary you copy carries it as well.

For one request, the cached share of the input (rounded to whole tokens) is priced at the cached rate and the rest at the normal input rate. Output tokens are either the fixed number you typed or the input count times your ratio, rounded. Each token count is multiplied by its price and divided by 1,000,000; multiplying first keeps round figures exact, so 1,000,000 tokens at 3.00 per million comes to exactly 3.00. The batch discount then comes off the whole request, input and output alike, and the result is multiplied by the number of requests.

The context check adds the input to the expected output and compares the sum with the window you typed. When it does not fit, the estimate works out how many parts the input would need so that each part plus its own reply fits. With a fixed output size, every part has to leave room for the whole reply, so the input is divided by the window minus the output and rounded up. With a ratio, each part's reply grows with the part, so the input plus its proportional output is divided by the window and rounded up. If a fixed reply is as large as the window on its own, no split can help, and the result states that.

When to use it

  • Budgeting a one-off job that classifies or summarises every row of a spreadsheet
  • Comparing two models for the same prompt by typing each one's prices in turn
  • Checking whether a long contract or report fits in one request or has to be sent in parts
  • Seeing how much a long system prompt adds when it is repeated in every call
  • Writing down the assumptions behind a cost figure in a CSV that someone else can check

Inputs

  1. Paste the full text one request will contain: system instructions, examples and a typical piece of user content. Or open it as a text file.
  2. Check the estimate and its range. If you have a measured count, choose Type a count I already have and enter it.
  3. Type the input and output prices per 1 million tokens from your provider's current price page.
  4. Enter the expected reply length, as tokens or as a ratio of the input, and the number of requests.
  5. Add a cached share and its price, or a batch discount, only if your provider offers them and your workload qualifies.
  6. Type the model's context window to see whether one request fits, then copy the summary or download the CSV.

Worked example

Ticket triage prompt, 20,000 requests (prices made up for this example)

Text: instructions plus one sample ticket, 7,200 characters, 1,250 words, no CJK
Input price:   0.50 per 1M tokens
Output price:  1.50 per 1M tokens
Output:        150 tokens per reply (fixed)
Requests:      20,000
Context window: 8,000 tokens

Estimate

Input tokens:      about 1,733 (1,416 to 2,070)
Cost per request:  0.000933 to 0.00126 (estimate 0.00109)
Total:             18.66 to 25.20 (estimate 21.83)
Context window:    fits; the high end uses 2,220 of 8,000 tokens (28%)

Tips for best results

  • Paste a realistic request, not an empty template. Placeholders like {ticket_text} are far shorter than the text they stand for.
  • Estimate replies from real output where you can: run a few requests, note the output token counts in the usage report, and type their typical value.
  • For chat features, remember that each turn usually resends the earlier messages. Estimate a typical late turn, not the first one.
  • If your provider has a cheaper rate for repeated prompt prefixes, set the cached share to the part of the prompt that stays the same between calls, such as the instructions and examples.
  • Keep the CSV with the project notes. When prices change, open it, see which figures you assumed and run the numbers again.

Limits

The range is a guide, not a guaranteed bound. Text full of long numbers, encoded data such as base64, unusual symbols or emoji can fall outside it, and so can languages the simple word count does not suit.

Only the text you paste is counted. Tool or function definitions, earlier chat turns, attached images, audio or files, and the small amount of formatting an API adds around each message are not included unless you add them yourself.

Some models bill hidden reasoning as output tokens even though you never see that text. If yours does, raise the expected output to allow for it, or your output cost will be too low.

One price per direction is assumed. Providers can charge more beyond a certain prompt length, add per-request or per-image fees, set minimum charges or bill in a different currency from the one you think in, none of which this page models.

The batch discount is applied to the whole request, cached part included. Whether a provider combines the two that way, or at all, is set in its own terms; check them before relying on a figure that uses both.

Common errors and how to fix them

"Type the input price and output price to see costs."
No prices are built in, so the cost table stays empty until both are typed. Copy them from your provider's price page for the model you plan to use; type 0 for output if you really expect no reply tokens.
"Input price must be a number such as 2.5, with no currency sign or letters."
Remove the currency sign, the word per or the M suffix and type only the number, such as 0.15. The amounts on the page are in whatever currency that number was in.
"Number of requests must be a whole number."
Requests are counted, not measured: type 1500, not 1.5k or 1,500.5. A value with thousands commas, such as 20,000, is accepted.
"Type the cached input price to see costs."
A cached share needs its own price, because cached tokens are billed at a separate rate. Type it, or clear the cached share to price all input at the normal rate.
A file is refused as a ZIP-based file, a PDF or a binary file.
Plain text is all this estimator reads. Select the words in Word or your PDF reader and paste them into the box, so the count covers exactly what a request would carry; saving a .txt copy works too. For a file over 10 MB, paste a typical part and raise the number of requests to match.
The context check says the expected output alone fills the window.
A fixed reply length equal to or above the window leaves no room for any input. Lower the expected output, check that the window figure is in tokens rather than words, or type the larger window of another model.

Best practices

  • Copy prices from the provider's page on the day you estimate, and note that date with the CSV.
  • Plan around the high end of the range, not the estimate, when the result feeds a budget or a quote.
  • Measure a small pilot run and compare its real token counts with the estimate before committing to a large job.
  • Leave headroom in the context window: the reply, any tool definitions and the conversation so far all share it.

Caching and a batch discount on the same job

Take a job with a measured 1,800 input tokens and a fixed 150-token reply per request, 20,000 requests, and made-up prices of 0.50 per million input tokens and 1.50 per million output tokens. One request costs 0.0009 for input and 0.000225 for output, 0.001125 in all, which the page shows rounded as 0.00113; the run comes to 22.50.

Now say 60 percent of each prompt is a fixed instruction block that the provider bills at a cached rate of 0.05 per million. Per request, 1,080 tokens are cached and cost 0.000054, the other 720 cost 0.00036, and the reply still costs 0.000225, for 0.000639 per request and 12.78 for the run. Add a 50 percent batch discount on top and each request falls to 0.0003195, so the run comes to 6.39. Each step is shown as its own row in the cost table and in the CSV, so it is clear which assumption saved what.

When the input does not fit

Suppose a report estimated at 30,000 tokens has to be summarised by a model with an 8,000-token window, with a fixed 2,000-token summary per request. Input plus output is 32,000 tokens, four times the window. Every part must leave 2,000 tokens for its summary, so each part can hold 6,000 input tokens, and 30,000 divided by 6,000 gives 5 parts.

Splitting changes the bill as well: five requests produce five summaries, so five times the output tokens. Set the number of requests to the number of parts and price the run again. The count also assumes the text can be cut anywhere; cutting at section breaks, or repeating the instructions in every part, can push it up by one.

What stays on your device

The pasted text, the text of a loaded file and every figure you type are held in the page's own state while the tab is open, and the counts and costs are worked out again from that state whenever something changes. The estimator transmits none of it and keeps no copy between visits, so a reload starts over with an empty text box. The prices and window sizes it uses are only ever the ones you typed, so they are exactly as current as the provider page you copied them from.

Frequently asked questions

Why are there no prices to choose from?

Prices differ between providers and models, change without notice and sometimes vary by region or volume. A built-in list would go stale and give wrong answers with false confidence, so the page asks you to type the figures you are actually going to pay.

Should I type a measured count instead of using the estimate?

When you have one, yes. The estimate only looks at how many characters and words you pasted, so it has no way to know how a given model will split your particular prompt, and that is why every cost here is shown as a spread. The input token figure reported back for one real request with the same prompt removes the spread: choose Type a count I already have, enter it, and the summary and CSV label the figure as typed rather than estimated.

What does an output ratio of 0.25 mean?

That each reply is expected to be a quarter as long as the input, measured in tokens: 4,000 input tokens give 1,000 output tokens. Ratios suit summaries and translations, whose length follows the input; a fixed number suits classifications and short answers.

Does the context check split my text for me?

No. It only tells you how many parts the input would need. The text itself is not changed or cut.

Why do Low and High sometimes show the same amount?

Amounts are rounded for display, so two costs a tiny fraction apart can print identically; the CSV keeps up to eight decimals and still shows the difference. With a typed token count the columns match exactly, since there is no range to spread across.