pub fn context_window_for(model: &str) -> Option<u32>Expand description
Infer context window size from model name.
Honours the CONTEXT_SIZE env variable first so users can override.
§Model Context Window Reference (2025)
| Provider | Model | Context Window |
|---|---|---|
| Anthropic | Claude 3/4 series | 200K |
| Anthropic | Claude 1M variants | 1M |
| OpenAI | GPT-4o, GPT-4-Turbo | 128K |
| OpenAI | o1, o3, o4 series | 200K |
| OpenAI | GPT-4 | 8K/32K |
| OpenAI | GPT-3.5 | 4K/16K |
| 智谱 AI | GLM-5, GLM-4-Long | 1M |
| 智谱 AI | GLM-4 | 128K |
| DeepSeek | V3, R1 | 128K |
| DeepSeek | V2, others | 64K |
| 阿里 Qwen | Qwen2.5-Turbo, Qwen-Long | 1M |
| 阿里 Qwen | Qwen2.5, Qwen3, Qwen-Max | 128K |
| 阿里 Qwen | Qwen2 | 32K |
| 月之暗面 | Kimi | 2M (长文本领先) |
| Gemini 1.5/2.0 Pro | 1M-2M | |
| Llama | 70B, 405B | 128K |
| Llama | others | 8K |