Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Claude Agent models get their 1M context window

justrach453179c2425e
diff --git a/src/pricing.zig b/src/pricing.zig
index 41ae97ab..a4ab6adc 100644
--- a/src/pricing.zig
+++ b/src/pricing.zig
@@ -311,6 +311,8 @@ pub var context_overlay: []const ModelInfo = &.{};
/// Context window for a model as served by a specific provider; falls back
/// to any provider's row for the name, then to the conservative default.
pub fn contextFor(provider_id: []const u8, model: []const u8) u64 {
+ // `<id>[1m]` is Claude Code's spelling of an id's 1M window (claude-agent passes it through).
+ if (std.mem.endsWith(u8, model, "[1m]")) return @max(1_000_000, contextFor(provider_id, model[0 .. model.len - "[1m]".len]));
// The ChatGPT plan route caps input like the Codex backend it shares.
const is_codex = std.mem.eql(u8, provider_id, "codex") or std.mem.eql(u8, provider_id, "chatgpt-new");
const subscription_cap = if (std.mem.eql(u8, model, "gpt-6.1-sol")) sol_subscription_context_window else codex_context_window;
diff --git a/src/pricing_models.zig b/src/pricing_models.zig
index 6206bcf5..b44420b3 100644
--- a/src/pricing_models.zig
+++ b/src/pricing_models.zig
@@ -34,16 +34,17 @@ pub const rows = [_]ModelInfo{
.{ .provider = "anthropic", .name = "claude-sonnet-4-5", .context = 200_000 },
// Claude Agent (ADR 0309): the models Claude Code's opus/fable/sonnet/
// haiku aliases resolve to, under their real names, so the plan reads like
- // any other. `claude-agent/<id>` passes any id Claude Code accepts. 200k is
- // the window Claude Code reports without a `[1m]` suffix.
- .{ .provider = "claude-agent", .name = "claude-opus-5-5", .context = 200_000 },
- .{ .provider = "claude-agent", .name = "claude-fable-5-1", .context = 200_000 },
- .{ .provider = "claude-agent", .name = "claude-sonnet-5-5", .context = 200_000 },
- .{ .provider = "claude-agent", .name = "claude-haiku-5-5", .context = 200_000 },
+ // any other. `claude-agent/<id>` passes any id Claude Code accepts. Claude
+ // Code runs each of these at 1M natively (its result reports contextWindow
+ // 1000000 with or without a `[1m]` suffix), so the window matches Anthropic's.
+ .{ .provider = "claude-agent", .name = "claude-opus-5-5", .context = 1_000_000 },
+ .{ .provider = "claude-agent", .name = "claude-fable-5-1", .context = 1_000_000 },
+ .{ .provider = "claude-agent", .name = "claude-sonnet-5-5", .context = 1_000_000 },
+ .{ .provider = "claude-agent", .name = "claude-haiku-5-5", .context = 1_000_000 },
// The previous generation Claude Code still offers by name.
- .{ .provider = "claude-agent", .name = "claude-opus-5", .context = 200_000 },
- .{ .provider = "claude-agent", .name = "claude-fable-5", .context = 200_000 },
- .{ .provider = "claude-agent", .name = "claude-sonnet-5", .context = 200_000 },
+ .{ .provider = "claude-agent", .name = "claude-opus-5", .context = 1_000_000 },
+ .{ .provider = "claude-agent", .name = "claude-fable-5", .context = 1_000_000 },
+ .{ .provider = "claude-agent", .name = "claude-sonnet-5", .context = 1_000_000 },
.{ .provider = "deepseek", .name = "deepseek-v4-pro", .context = 1_000_000 },
.{ .provider = "deepseek", .name = "deepseek-v4-flash", .context = 1_000_000 },
.{ .provider = "deepseek", .name = "deepseek-chat", .context = 1_000_000 },
diff --git a/src/pricing_tests.zig b/src/pricing_tests.zig
index f8f1020e..8de24a60 100644
--- a/src/pricing_tests.zig
+++ b/src/pricing_tests.zig
@@ -187,6 +187,13 @@ test "contextFor known model and default fallback" {
try std.testing.expectEqual(@as(u64, pricing.default_context), pricing.contextFor("nope", "unknown-xyz"));
}
+test "contextFor gives Claude Agent the 1M window Claude Code runs" {
+ try std.testing.expectEqual(@as(u64, 1_000_000), pricing.contextFor("claude-agent", "claude-opus-5-5"));
+ try std.testing.expectEqual(@as(u64, 1_000_000), pricing.contextFor("claude-agent", "claude-sonnet-5-5[1m]"));
+ try std.testing.expectEqual(@as(u64, 1_000_000), pricing.contextFor("claude-agent", "claude-opus-4-5[1m]"));
+ try std.testing.expectEqual(@as(u64, pricing.default_context), pricing.contextFor("nope", "unknown-xyz"));
+}
+
test "Kimi discovery preserves Codex and chooses the newest pure generation" {
const saved = pricing.active_model_table;
defer pricing.active_model_table = saved;