Skip to main content

Module limits

Module limits 

Source
Expand description

Canonical context-window limits for known LLM models.

This is the single source of truth for context_window_for_model. Every subsystem — session compaction, RLM routing, TUI token badges, Bedrock estimates — must delegate here rather than maintaining its own heuristic map.

§Adding a new model

Add a contains match arm below. Order matters: more specific patterns must come before broader ones (e.g. "claude-opus-4-7" before "claude").

§Examples

use codetether_agent::provider::limits::context_window_for_model;

assert_eq!(context_window_for_model("zai/glm-5"), 200_000);
assert_eq!(context_window_for_model("kimi-k2.5"), 256_000);
assert_eq!(context_window_for_model("claude-opus-4-7"), 1_000_000);
assert_eq!(context_window_for_model("unknown-model"), 128_000);

Functions§

context_window_for_model
Return the context window size (in tokens) for known models.