A context window is the maximum number of tokens a language model can handle in one request, counting everything it reads (instructions, conversation history, documents and tool definitions) plus the tokens it writes. A request that does not fit has to be shortened or split.
The context window is measured in tokens. Everything the model reads in a single request counts toward it:
The tokens the model generates share the same window, including the reasoning tokens of a reasoning model. Each chat request carries the conversation so far in messages, so a long conversation sends its whole history on every turn and moves closer to the limit as it grows. For example, 20 turns of about 500 tokens each add roughly 10,000 tokens of history to the next request, before the new message and the answer.
A model has two separate limits. The context window covers input and output together. The maximum output is the most tokens the model can write in one response, and it is usually smaller than the window. GET /v1/models reports both, as context_window (also context_length) and max_output_tokens.
You can set your own output limit for each request. max_tokens limits the tokens generated, and max_completion_tokens limits reasoning and answer together; when you send both, the smaller one applies. A response that reaches the limit stops early with finish_reason set to length, so raise the limit if answers end mid-sentence. On /v1/responses the same limit is max_output_tokens, and a response cut off by it ends with the status incomplete.
When the input, together with max_tokens if you set it, is longer than the model's context window, EmpirioLabs AI returns 400 with the code context_length_exceeded before any generation starts, and the request is not billed. Shorten the input or lower max_tokens, then send it again. Agent frameworks that compact conversations use this code as their signal to do so. The errors reference shows the full response.
To check a request before you send it, POST /v1/messages/count_tokens returns an estimate of its input tokens and is not billed. The usage object in each response then reports the exact count.
max_tokens to the task. The length check counts max_tokens together with the input, so an oversized value can reject a request whose input would otherwise fit.A larger window is not always better. A model can overlook details in a very long input, so a short, relevant context often gives more accurate answers than a long one. Compare context windows across text models, or test long prompts in the Playground.
96 models list a context window. Each model's page has its full specs and limits.
| Model | Context window | Max output |
|---|---|---|
| Step 5 Preview StepFun | 1.02M tokens | 128K tokens |
| Qwen3.8 Omni Flash Alibaba Cloud | 1.01M tokens | 128K tokens |
| Aplomb 1 EmpirioLabs | 1M tokens | - |
| DeepSeek V4 Flash 0731 DeepSeek | 1M tokens | 384K tokens |
| DeepSeek V4 Pro DeepSeek | 1M tokens | 384K tokens |
| DeepSeek V4 Pro 0813 DeepSeek | 1M tokens | 384K tokens |
| DeepSeek V4.1 Flash 1017 DeepSeek | 1M tokens | 384K tokens |
| Fugu Max Sakana AI | 1M tokens | 128K tokens |
| Model | Context window | Max output |
|---|---|---|
| Fugu Ultra v1.0 Sakana AI | 1M tokens | 128K tokens |
| Fugu Ultra v1.1 Sakana AI | 1M tokens | 128K tokens |
| Fugu Ultra v2.0 Sakana AI | 1M tokens | 128K tokens |
| GLM 5.2 Z.ai | 1M tokens | 128K tokens |
| GLM 5.3 Z.ai | 1M tokens | 128K tokens |
| GLM 5.3 Flash Z.ai | 1M tokens | 128K tokens |
| Kimi K3 Moonshot AI | 1M tokens | 128K tokens |
| Kimi K3.1 Pro Moonshot AI | 1M tokens | 128K tokens |
| MiMo V2.6 Flash Xiaomi | 1M tokens | 128K tokens |
| MiMo V2.6 Pro Xiaomi | 1M tokens | 128K tokens |
| MiMo V2.6 Pro UltraSpeed Xiaomi | 1M tokens | 128K tokens |
| MiniMax M3 MiniMax | 1M tokens | 512K tokens |
| MiniMax M3.1 Flash MiniMax | 1M tokens | 512K tokens |
| Muse Spark 1.1 Meta AI | 1M tokens | 128K tokens |
| Muse Spark 1.2 Meta AI | 1M tokens | 128K tokens |
| Muse Spark 1.3 Meta AI | 1M tokens | 128K tokens |
| Nova Lite 2 Amazon | 1M tokens | 128K tokens |
| Qwen3.5 Flash Alibaba Cloud | 995.9K tokens | 32K tokens |
| Qwen3.5 Plus Alibaba Cloud | 983.6K tokens | 64K tokens |
| Qwen3.6 Flash Alibaba Cloud | 983.6K tokens | 64K tokens |
| Qwen3.6 Plus Alibaba Cloud | 983.6K tokens | 64K tokens |
| Qwen3.7 Flash Alibaba Cloud | 983.6K tokens | 64K tokens |
| Qwen3.7 Max Alibaba Cloud | 983.6K tokens | 64K tokens |
| Qwen3.7 Plus Alibaba Cloud | 983.6K tokens | 64K tokens |
| Qwen3.8 Flash Alibaba Cloud | 983.6K tokens | 128K tokens |
| Qwen3.8 Max Alibaba Cloud | 983.6K tokens | 128K tokens |
| Qwen3.8 Max 0902 Alibaba Cloud | 983.6K tokens | 128K tokens |
| Qwen4 Max Alibaba Cloud | 983.6K tokens | 256K tokens |
| Perplexity Deep Research Perplexity | 919.3K tokens | - |
| Perplexity Sonar Perplexity | 919.3K tokens | - |
| Perplexity Sonar Pro Perplexity | 919.3K tokens | 32K tokens |
| Perplexity Sonar Reasoning Pro Perplexity | 919.3K tokens | 128K tokens |
| Nova Lite 1.0 Amazon | 317.4K tokens | 10K tokens |
| Nova Pro 1.0 Amazon | 317.3K tokens | 10K tokens |
| Qwen3.5 122B-A10B Alibaba Cloud | 258K tokens | 64K tokens |
| Qwen3.5 27B Alibaba Cloud | 258K tokens | 64K tokens |
| Qwen3.5 35B-A3B Alibaba Cloud | 258K tokens | 64K tokens |
| Qwen3.5 397B-A17B Alibaba Cloud | 258K tokens | 64K tokens |
| Gemma 4 26B-A4B Google | 256K tokens | 32K tokens |
| Kimi K2.6 Moonshot AI | 256K tokens | 16K tokens |
| Kimi K2.7 Code Moonshot AI | 256K tokens | 128K tokens |
| Kimi K2.7 Code Highspeed Moonshot AI | 256K tokens | 128K tokens |
| Mistral Small 4 Mistral AI | 256K tokens | 64K tokens |
| Qwen3.5 4B Alibaba Cloud | 256K tokens | 32K tokens |
| Qwen3.5 9B Alibaba Cloud | 256K tokens | 32K tokens |
| Qwen3.8 27B Alibaba Cloud | 256K tokens | 32K tokens |
| Step 3.5 Flash StepFun | 256K tokens | 128K tokens |
| Step 3.5 Flash 2603 StepFun | 256K tokens | 128K tokens |
| Step 3.7 Flash StepFun | 256K tokens | 128K tokens |
| StepAudio 2.5 Chat StepFun | 256K tokens | 128K tokens |
| StepAudio 2.5 Realtime StepFun | 256K tokens | 128K tokens |
| StepAudio 3 Chat StepFun | 256K tokens | 128K tokens |
| StepAudio 3 Realtime StepFun | 256K tokens | 128K tokens |
| Qwen Audio 3.1 Realtime Flash Alibaba Cloud | 240K tokens | 16K tokens |
| Qwen Audio 3.1 Realtime Plus Alibaba Cloud | 240K tokens | 16K tokens |
| Seed 2.0 Mini ByteDance | 229.2K tokens | 128K tokens |
| Seed 2.0 Code ByteDance | 229.1K tokens | 128K tokens |
| Seed 2.0 Lite ByteDance | 229.1K tokens | 128K tokens |
| Seed 2.0 Pro ByteDance | 229.1K tokens | 128K tokens |
| Seed 2.1 Turbo ByteDance | 229.1K tokens | 64K tokens |
| Qwen3.6 27B Alibaba Cloud | 224K tokens | 64K tokens |
| GLM 4.7 Flash Z.ai | 202.8K tokens | 128K tokens |
| GLM 4.7 FlashX Z.ai | 202.8K tokens | 128K tokens |
| GLM 5.1 Z.ai | 202.7K tokens | 128K tokens |
| Qwen3.5 Omni Flash Alibaba Cloud | 192K tokens | 32K tokens |
| Qwen3.5 Omni Flash Realtime Alibaba Cloud | 192K tokens | 64K tokens |
| Qwen3.5 Omni Plus Alibaba Cloud | 192K tokens | 32K tokens |
| Qwen3.5 Omni Plus Realtime Alibaba Cloud | 192K tokens | 64K tokens |
| Qwen3.8 Omni Flash Realtime Alibaba Cloud | 192K tokens | 64K tokens |
| DeepReasoning WinFunc | 160K tokens | 32K tokens |
| Nova Micro 1.0 Amazon | 133K tokens | 10K tokens |
| GLM 4.5 Flash Z.ai | 128K tokens | 96K tokens |
| GLM 4.6V Flash Z.ai | 128K tokens | 32K tokens |
| GLM 4.6V FlashX Z.ai | 128K tokens | 32K tokens |
| Gemini 3.8 Live Google | 128K tokens | 64K tokens |
| Gemini 3.8 Live Extended Thinking Google | 128K tokens | 64K tokens |
| Gemma 3 27B Google | 128K tokens | 16K tokens |
| Muse Glimmer 30B Meta AI | 128K tokens | 32K tokens |
| Qwen3.6 35B A3B Alibaba Cloud | 128K tokens | 16K tokens |
| Mistral Small 3.1 Mistral AI | 89.6K tokens | 32K tokens |
| Qwen3.8 LiveTranslate Flash Realtime Alibaba Cloud | 48K tokens | 4K tokens |
| Qwen Audio 3.0 Realtime Flash Alibaba Cloud | 16K tokens | 8K tokens |
| Qwen Audio 3.0 Realtime Plus Alibaba Cloud | 16K tokens | 8K tokens |
| Skylark Embedding Vision ByteDance | 8K tokens | - |
| Text Embedding v4 Alibaba Cloud | 8K tokens | - |
| Qwen3 Rerank Alibaba Cloud | 4K tokens | - |
| Tongyi Embedding Vision Flash Alibaba Cloud | 1K tokens | - |
| Tongyi Embedding Vision Plus Alibaba Cloud | 1K tokens | - |
Yes. Input and output share the window, so a long prompt leaves less room for the answer. The API checks the input plus max_tokens, when you set it, against the window before it runs the request.
The API returns a 400 error with the code context_length_exceeded before any generation, and the request is not billed. Shorten the input or lower max_tokens, then send it again.
No. The context window covers input and output together, while the maximum output limits how many tokens the model writes in one response. Both are listed for each model.
Send the request body to POST /v1/messages/count_tokens for an estimate of its input tokens, which is not billed. The usage object in each response reports the exact count.
Check out our pricing or reach out if you want your own model deployed on our stack.