Imọ Itọsọna

Token Counting and LLM API Pricing

LLM APIs charge per token, a chunk of text that is roughly three-quarters of an English word.

  • 4 min ka
  • kẹhin imudojuiwọn
Lori iwe yi4 min ka
  1. Akopọ
  2. Jin Dive
  3. Ipa Ilana
  4. The Future of Token Counting and LLM API Pricing
  5. Real-World imuse
  6. Awọn ewu & Awọn ọna iṣọ
  7. Ilana Ilana imuse
  8. Tesiwaju Ṣiṣawari
  9. Awọn ibeere ti a beere nigbagbogbo

Akopọ

Input tokens you send and output tokens the model generates have separate rates, and output usually costs several times more. To estimate cost, count tokens with the provider's tokenizer or counting endpoint and multiply each side by its per-million rate. Include hidden tokens such as system prompts, conversation history and reasoning.

Jin Dive

Models do not read characters or words directly. A tokenizer splits text into tokens, which are common character sequences learned from training data. A common rule of thumb for English is about four characters, or three-quarters of a word, per token. That puts 1,000 words at roughly 1,300 to 1,400 tokens. Code, numbers, unusual names and many non-English languages use more tokens per word. Each model family has its own tokenizer, so the same text can produce different counts with different providers. Prices are usually quoted per million tokens, with separate input and output rates. Output tokens cost more because the model generates them one at a time, while it can process input tokens in parallel. Output is commonly priced at several times the input rate, often somewhere between four and eight times, though ratios vary by model. Here is a worked example with made-up prices: input at $3 per million tokens and output at $15 per million. A task sends 6,000 input tokens (system prompt, instructions and a document) and gets back 800 output tokens. - Input: 6,000 x $3 / 1,000,000 = $0.018 - Output: 800 x $15 / 1,000,000 = $0.012 - Total: $0.03 per task At 10,000 tasks a day, that comes to about $300 a day. Real bills often surprise people, for predictable reasons: - Chat applications resend the whole conversation on every turn, so input grows with each message. - Reasoning models generate internal thinking tokens that are billed as output, even when they are not shown in full. - Tool definitions, retrieved documents and images all count as input. - Retries and failed calls cost money too. Three misconceptions are common: that tokens equal words, that filling a model's context window is free, and that the model with the lowest per-token price is always cheapest per task. A stronger model that finishes in fewer attempts can cost less overall.

Ipa Ilana

Iye owo ati isuna

Awọn ipinnu faaji ṣe awakọ iṣẹ ati idiyele iṣẹ fun awọn ọdun.

Awọn ipinnu diẹ sii

Ẹkọ imọ-ẹrọ ṣe iranlọwọ fun awọn ẹgbẹ lati yan akopọ to tọ, kii ṣe ọkan tuntun nikan.

Iṣakoso didara

Awọn yiyan imọ-ẹrọ to dara julọ dinku awọn iṣẹlẹ igbẹkẹle ni iṣelọpọ.

The Future of Token Counting and LLM API Pricing

Per-token prices for a given level of capability have fallen substantially over the past few years. Total spending often rises anyway, because applications use longer contexts, agents make many calls and reasoning models produce more output. Pricing is also getting more varied, with separate rates for cached input, long-context requests, batch jobs and reasoning. That makes it more important to measure actual usage per task than to compare headline prices. Cost tools such as budgets, per-feature cost tracking and automatic model routing are likely to become standard parts of LLM applications.

Real-World imuse

A developer uses OpenAI's open-source tiktoken library to count a 3,000-word support article before sending it. It comes to roughly 4,000 tokens, and she sets a budget alert to match.

A chatbot team finds that most of its bill comes from resending a 2,000-token system prompt and the full chat history on every turn. It cuts costs by summarizing older turns and using prompt caching.

A company processing 50,000 product descriptions overnight moves the job to a provider's batch API. The batch API charges less, and in return results arrive within hours instead of seconds.

A team translating content into Hindi and Japanese budgets more per page than for English. With common tokenizers, the same meaning often takes more tokens in those languages.

Awọn ewu & Awọn ọna iṣọ

  • Ṣiṣepe ala-ilẹ kan le tọju awọn ailagbara eto ti o gbooro.

  • Awọn ohun elo amayederun ati awọn idiyele itọju nigbagbogbo ni aibikita.

  • Aabo ati awọn ela akiyesi le dagba bi awọn eto ṣe di eka sii.

Ilana Ilana imuse

  1. Ṣetumo lairi, didara, ati awọn ibi-afẹde idiyele ṣaaju imuse.

  2. Aṣepari labẹ ẹru ojulowo ati awọn ipo data.

  3. Abojuto ohun elo fun awọn aṣiṣe, fiseete, ati ipa olumulo.

  4. Mura ipadasẹhin pada ati awọn ipa ọna esi iṣẹlẹ ṣaaju iwọn.

Tesiwaju Ṣiṣawari

Free newsletter

Get the daily AI briefing

Three verified AI stories every weekday morning, written in plain English. Free forever, no ads.

One email each weekday. Unsubscribe in one click. We never sell or share your address.

Test yourself

Take the Token Counting and LLM API Pricing quiz

Instant feedback on every answer, and a shareable certificate with a verifiable ID once you pass a course.

Bẹrẹ adanwo

Support free AI education. AI Understanding is a 501(c)(3) nonprofit — no ads, no paywall, ever. Make a donation

Awọn ibeere ti a beere nigbagbogbo

What is Token Counting and LLM API Pricing?

LLM APIs charge per token, a chunk of text that is roughly three-quarters of an English word. Input tokens you send and output tokens the model generates have separate rates, and output usually costs several times more. To estimate cost, count tokens with the provider's tokenizer or counting endpoint and multiply each side by its per-million rate. Include hidden tokens such as system prompts, conversation history and reasoning.

What is a common rule of thumb for English text and tokens?

English averages about four characters or 0.75 words per token, so 1,000 words is roughly 1,300 to 1,400 tokens.

Why are output tokens usually priced higher than input tokens?

Generating tokens one by one takes more compute time than processing input tokens in parallel.

With made-up prices of $3 per million input tokens and $15 per million output tokens, what does a call with 6,000 input and 800 output tokens cost?

6,000 x 3 / 1,000,000 = $0.018 and 800 x 15 / 1,000,000 = $0.012, which adds up to $0.03.

Why do chatbot costs often grow as a conversation goes on?

Each new message usually includes all the earlier turns, so input tokens pile up unless history is trimmed or summarized.

How are a reasoning model's internal thinking tokens typically billed?

Thinking tokens are generated by the model, so they are billed as output even if you do not see all of them.