Include reasoning tokens on thinking models.
For chat-template tokens and tokenizer differences.

Does not fit

43,471 tokens over

System promptConversation historyDocuments or retrieved textUser messageReplyMargin
32,768context limit
27,129available for input
70,600input planned
available = 32,768 − 4,000 reply − 1,639 margin = 27,129
spare     = 27,129 − 70,600 = -43,471

Limit published by Featherless, checked 14 November 2026.

Why plan the context

The context limit covers input and output together. If the input leaves too little room, the reply is cut short or the request is rejected; MolochAI, for example, documents a 413 error with the cap when a request is over its limit. The limit that matters is the provider's, which is often lower than the model's configured context: the same Gemma 4 variant is listed with 32,768 tokens at one provider and 64,000 at another, while the base model's configuration allows 262,144.

Caveats

  • Token counts depend on the model's tokenizer. Count with the tokenizer of the model you will call, or read usage.prompt_tokens from a real response.
  • Chat templates add tokens around every message, which is what the margin is for.
  • Thinking models spend output tokens on reasoning before the answer, so reserve more than the visible reply.
  • Some providers cap output per reply separately from the context; the planner warns when your reservation exceeds a known cap.

Related: token cost calculator, VRAM estimator for long contexts on your own hardware.