Skip to main content

context_window_for

Function context_window_for 

Source
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)

ProviderModelContext Window
AnthropicClaude 3/4 series200K
AnthropicClaude 1M variants1M
OpenAIGPT-4o, GPT-4-Turbo128K
OpenAIo1, o3, o4 series200K
OpenAIGPT-48K/32K
OpenAIGPT-3.54K/16K
智谱 AIGLM-5, GLM-4-Long1M
智谱 AIGLM-4128K
DeepSeekV3, R1128K
DeepSeekV2, others64K
阿里 QwenQwen2.5-Turbo, Qwen-Long1M
阿里 QwenQwen2.5, Qwen3, Qwen-Max128K
阿里 QwenQwen232K
月之暗面Kimi2M (长文本领先)
GoogleGemini 1.5/2.0 Pro1M-2M
Llama70B, 405B128K
Llamaothers8K