Context Budget Planner

Estimate tokens for system, tools, history, and user slots against a model context limit. Useful when designing agent chat layout.

Read the full guide: RAG Optimization Guide: Balancing Chunking, Embedding Dimensions and Context Budget →

Privacy: processed locally, never uploaded.

↓ Paste in the input area below to see results instantly

Estimate token usage across system, tools, history, and user slots.

System
Tools
History
User

System

7

Tools

0

History

0

User

5

Total tokens

12

Remaining

127988

Used

0.0%

Notes

vs Context Window Checker

This splits budget by conversation slots; Context Window Checker compares whole text per model. Both use heuristics.

Estimate tokens for system, tools, history, and user slots against a model context limit. Useful when designing agent chat layout.

Quick start

  1. Pick model

    Context limit comes from the model list.

  2. Fill four slots

    See total, remaining, and percent used.

Slot meanings

System is system prompt; Tools is function defs; History is prior messages; User is the current turn.

Typical Workflow

When designing an AI dialogue agent, first select the target model (e.g. GPT-4) in the tool. The context window limit will be displayed automatically. Then input content into the four slots (system, tools, history, user) respectively to see real-time token usage for each section. Adjust prompt length to stay under the limit while reserving space for subsequent dialogues.

For instance, when building a customer service bot, you might allocate 50 tokens for role definition in system slot, 200 tokens for API descriptions in tools slot, 300 tokens for conversation history, and reserve 500 tokens for user input. The color-coded progress bars visually show proportions, triggering alerts when nearing the limit - indicating when to simplify tool descriptions or shorten history.

Examples

Example

Input

gpt-4o-mini + 4 slots

Output

Per-slot tokens + remaining

FAQ

Same as context checker?

Checker uses whole text; this splits by slot for multi-turn planning.

Why reserve tokens specifically for user slot?

User input length is unpredictable. Reservation prevents overflows - e.g. with GPT-4-32k's 32,768 limit, if other sections use 32,000 tokens, only 768 tokens remain for users. We recommend reserving 15-20% for user input + AI response, more for complex scenarios.