DigitSpace

Tokens and how LLM pricing works

AI APIs charge by the token, a piece of text roughly four characters of English long. Each model has a price per million input tokens and a higher price per million output tokens; a request costs its input tokens times the input price plus its output tokens times the output price.

Request req_8f2c41b9

30 Oct 2026, 14:02:11 SGT · key production-api

Asked forauto
Served byclaude-haiku-5-5 on Anthropic
Input1,840 × $0.10 / 1M
Output212 × $0.50 / 1M
Cost$0.000290
First token · total410 ms · 1.9 s

Working out one request

claude-haiku-5-5 at $0.10 per million input tokens and $0.50 per million output tokens.

  1. Input.

    1,840 tokens × $0.10 / 1,000,000 = $0.000184

  2. Output.

    212 tokens × $0.50 / 1,000,000 = $0.000106

  3. Total.

    $0.000290, or about $0.29 per thousand such requests

An engraving of a wall-mounted telephone transmitter from a 1906 telephone handbook.

From a 1906 handbook on telephone exchanges.

The practical telephone handbook and guide to the telephonic exchange, 1906. Internet Archive Book Images, no known copyright restrictions, via Wikimedia Commons.

Kinds of tokens

KindWhat it isPrice
InputEverything you send: system prompt, messages, tool definitionsThe model's input price
OutputWhat the model writes, including reasoning on reasoning modelsThe model's output price, usually higher
Cached inputInput the provider has already seen and keptMuch less than input, on providers that support it
Cache writeInput stored for later reuseA little more than input, on some providers

Rules of thumb

A page of English is about 500 to 700 tokens. Code and other languages often use more tokens per character. Images are charged as a number of tokens that depends on their size.

Questions

Why do output tokens cost more?

The model generates them one at a time, which takes far more computing than reading input.

How do I count tokens before sending?

The token cost calculator counts a prompt's tokens and prices it across models.

Read next

Live in a minute.

Create a key, change the base URL, send a request. No card needed with your own provider keys.

Start free