DevsAgentic

LLM Context Window Planner

Plan a token budget for instructions, retrieved content, history, tools, and output.

Planned total including output reserve

56,000 / 128,000 tokens

72,000 tokens unallocated

  • System and developer instructions: 4,000
  • Retrieved context: 24,000
  • Conversation history: 16,000
  • Tool definitions and other input: 4,000
  • Output reserve: 8,000

Budget only: token counts are your estimates. Actual tokenization, hidden provider overhead, tool schemas, and model-specific limits may differ. No input is uploaded.

How to plan an LLM context window

Enter the context capacity documented for your selected model, then estimate how many tokens each part of a request uses. Reserve room for the generated answer before allocating the rest to instructions, retrieved passages, conversation history, and tool definitions. The bar shows the planned distribution; remaining capacity is intentionally left unallocated rather than silently treated as prompt content.

Example budget

For a 128,000-token window, a plan with 4,000 instruction tokens, 24,000 retrieved tokens, 16,000 history tokens, 4,000 tool tokens, and an 8,000-token output reserve uses 56,000 tokens. The remaining 72,000 tokens are available for additional context or safety margin. Use measurements from your own provider and workload when possible.

Frequently asked questions

Does the entire context window belong to the prompt?

No. Model output also uses capacity, and providers may apply additional limits or internal overhead.

Are these counts exact?

No. The planner adds numbers you provide; it does not tokenize text. Use a provider-specific tokenizer or usage metrics for precise counts.

What is an unallocated budget for?

It gives room for formatting, tool-call overhead, retrieved material that varies, and estimation error.

Measure before tuning your prompt

Token usage is affected by the exact model tokenizer and by how the provider serializes messages and tool definitions. A prompt that appears short as plain text can use more tokens once role markers, structured arguments, and response-format settings are included. Measure representative requests with provider usage data or the tokenizer intended for your model, then enter those measurements here as planning estimates. Revisit the budget when you add a tool, change a system instruction, or increase the number of conversation turns retained.

Retrieved context is often the easiest allocation to accidentally grow. Set a retrieval limit, remove duplicate passages, and check whether each selected chunk helps answer a representative question. Conversation history may need a summarization policy rather than an ever-growing window. Keep output room large enough for the expected answer, and check your provider's maximum generation setting separately: reserving tokens here does not configure the API request. For a character-level view of text splitting, try the RAG Chunk Visualizer.