Token

The chunk of text a model actually reads, usually a word piece, not a whole word. Limits, speed and price are all counted in these.

chunks of wordsthe thing they charge forword piecestokinshow it counts my textwhy long prompts cost morenot quite words, not quite lettersthe unit AI bills by

See it

Live demo coming soon

What it is

A model never sees letters or words. A tokenizer chops your text into pieces it has seen before, usually with byte pair encoding, and hands the model a list of numbers. Common English words are one token, rarer ones split ('unbelievable' becomes 'un' plus 'believ' plus 'able'). The rough English rule is 4 characters per token, or 750 words per 1000 tokens.

Tokens are the unit of everything you care about: the context window is measured in them, pricing is per million of them, and generation speed is tokens per second. Input tokens and output tokens are usually priced differently, and reasoning models usually bill their thinking as output tokens even though you never see them.

Gotcha: token cost is not evenly distributed. Code, JSON, long URLs, emoji, and non-English text (especially non-Latin scripts) can run 2 to 3 times more tokens per character than plain English prose, so a translated prompt can blow a budget that fit fine in English. Token boundaries are also why models fumble letter-level tasks like counting the r's in 'strawberry': they are looking at chunks, not characters.

Ask AI for it

Add a live token budget meter to this prompt composer. Count tokens client side with the tiktoken (or the provider's official tokenizer) package, debounced at 150ms, and show 'used / limit' against the model's context window. Colour the bar green under 60 percent, amber under 90, red above it, and split the count into system prompt, attached context, and the user message so it is obvious what is eating the window. Show an estimated request cost from the model's per million input token price next to it.

You might have meant

context windowtokenizerprompt cachingmax tokensstreaming

Go deeper