Skip to content
Neaptidestudio
blog

AI tokens explained: context limits and the cost of a request

Neaptide · September 6, 2026 · 6 min read · Updated: October 4, 2026

Understand tokens, context and AI costs with Claude Sonnet 5.5’s published API rates, usage checks and ways to reduce consumption.

On this page
Small paper fragments pass through a transparent window beside a few coins.

You send “fix the last paragraph” and usage jumps. The app may well have sent the whole conversation, a document and its own instructions along with it. Count only your latest message and you miss most of the request.

A token is not a word

A token is the unit a model works in, for reading input and for writing output. In text it can be a single character, part of a word or a whole word. There is no fixed words-to-tokens rate, because it depends on the tokenizer and on the text itself. Use the counter for the model you plan to use.

Context is capacity for a single request

The context window limits how much a model can use in one request. OpenAI documents it as a shared budget for input and output tokens and, on some models, reasoning tokens. Check two limits for your model, context and output. A large window will hold a long document, but nobody promises that every detail in it gets handled correctly.

Illustrative 2000-token window: 1200 input, 600 reserved for output, 200 spare
Teaching example, not a model specification. Reserved output space is different from actual usage.

Our fictional window holds 2,000 tokens: 1,200 for input, 600 reserved for output and 200 spare. If the answer comes to 300 tokens, then 300 were generated, whatever was reserved. Real APIs may also count reasoning and other usage categories.

What else goes into the input?

  • Application instructions and the conversation history it includes.
  • Document text, retrieved passages and tool results.
  • Images and other inputs, counted under the provider’s rules.

The application decides what it sends. OpenAI’s documentation says that with previous_response_id, all earlier input tokens in the chain are still billed as input. So a short follow-up in a long thread can use more input than a longer opening message.

Calculate with Claude Sonnet 5.5’s published rate

On 3 October 2026, Anthropic lists Claude Sonnet 5.5 at $2 per million input tokens and $10 per million output tokens. The calculation below uses that base rate; 1,200 input and 300 output tokens are an assumed workload, not a recorded API call. It excludes caching, Batch API, tools, tax and other surcharges.

Calculation using published prices, USD
CategoryTokensCalculationCost, USD
Input1 2001 200 × 2 / 1 000 0000.0024
Output300300 × 10 / 1 000 0000.0030
Total1 5000.0024 + 0.00300.0054

At this workload, 1,000 requests would cost $5.40; three identical attempts would cost $0.0162. These are calculations, not an invoice. Actual attempts vary in length, so add the usage charges for every call, including unsuccessful attempts.

Measure before and after

  1. Before sending, count the full input using the provider’s counter for the chosen model.
  2. Afterwards, read the usage data. Asking the model for its own token count only gets you a guess.
  3. Match usage categories to the pricing rules and the charges. The visible answer may not be all you paid for.
  4. Group requests by task to see the cost of the completed outcome.

OpenAI has an API endpoint that counts input tokens before a request is sent. Gemini’s documentation covers the same pre-count, plus the usage figures returned with each response. Check which fields your API version returns and what each one includes.

Cut waste without losing the brief

Start by removing duplicates, superseded documents and passages that have nothing to do with the task. Ask for the output you need, say five errors with supporting quotes instead of a full retelling. Constraints, exceptions and evidence stay in.

To carry a long conversation into a new chat, write a summary of the decisions, constraints, open questions and source links, and check it against the original before you rely on it. One lost condition can create more work than the shorter input saves.

Compare the cost of accepted work, review and rework included. A cheap call that leaves someone repairing the whole answer is not a cheap task.

faq

The short version

How many tokens are in a word?

There is no fixed number. Count the actual text with a tokenizer suited to your model.

Is the context window my monthly allowance?

No. It limits a single request. Subscription and rate limits are separate.

Does a new chat always cost less?

Only if the application sends less input. The essentials have to be supplied again, and missing context tends to cause retries.

Can I estimate a PDF by page count?

Not accurately. The file-processing method, content and model’s rules for text and images all matter.