Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat(setup): enable native /model picker via gateway model discovery
Set CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 so Claude Code populates /model from our
/anthropic/v1/models and the user can switch models natively. ANTHROPIC_MODEL[1m] stays the
1M default and does NOT lock the picker. Reset clears the key. Needs Claude Code >=2.1.129;
picker lists claude* ids (Codex via /setup-codex).

Co-Authored-By: Claude <noreply@anthropic.com>
  • Loading branch information
wangcansunking and claude committed Jun 29, 2026
commit 8b015cf282e736a71160fbb9edf5ed570d3a1f6a
5 changes: 5 additions & 0 deletions e2e/RESULTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Latest run of the end-to-end suite. Regenerate after every code change with `npm run test:e2e`
and update this file (paste the summary).

- **2026-06-29 (native /model picker)** — setup writes CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
so Claude Code populates /model from our /anthropic/v1/models; ANTHROPIC_MODEL[1m] stays the 1M
default and does NOT lock the picker (verified vs docs). Reset clears the new key. Picker lists
claude* ids; CC >=2.1.129. Project suite **422 passed**, e2e **43 passed**, build clean.

- **2026-06-29 (TUI UX batch)** — Status shows per-scope client model (not just a check); chat
setup tools require scope+model (ask before write); added recent_errors/metrics chat tools for
command parity; /report body restructured to the #5 template; heartbeat interval configurable;
Expand Down
1 change: 1 addition & 0 deletions src/tui/setup/apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const CLAUDE_ENV_KEYS = [
"ANTHROPIC_BASE_URL", "ANTHROPIC_API_KEY", "ANTHROPIC_MODEL", "ANTHROPIC_AUTH_TOKEN",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW", "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC", "CLAUDE_CODE_ATTRIBUTION_HEADER",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY",
];
export const CODEX_ENV_KEYS = ["OPENAI_BASE_URL", "OPENAI_API_KEY", "OPENAI_MODEL"];

Expand Down
4 changes: 4 additions & 0 deletions src/tui/setup/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export function claudeCopilotReverseEnv(base: string, apiKey: string, model: str
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE: "80",
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1",
CLAUDE_CODE_ATTRIBUTION_HEADER: "0", // keep prompt caching working on a non-Anthropic gateway
// Populate Claude Code's /model picker from our /anthropic/v1/models so the user can switch
// models natively. Coexists with ANTHROPIC_MODEL (which stays the 1M default — it does NOT lock
// the picker). Claude Code >=2.1.129 only; older builds ignore it. Picker lists claude* ids.
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY: "1",
};
}

Expand Down
1 change: 1 addition & 0 deletions tests/tui/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe("claudeCopilotReverseEnv", () => {
expect(env.CLAUDE_CODE_AUTO_COMPACT_WINDOW).toBe("1000000");
expect(env.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE).toBe("80");
expect(env.CLAUDE_CODE_ATTRIBUTION_HEADER).toBe("0");
expect(env.CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY).toBe("1"); // /model picker is populated, not locked
});
it("omits the window/suffix when it's unknown", () => {
const env = claudeCopilotReverseEnv("http://x", "k", "gpt-4o");
Expand Down
Loading