Allow custom ANTHROPIC_BASE_URL / model provider in the managed app (not just raw CLI)
Is your feature request related to a problem? Please describe.
The Claude Code CLI already supports pointing at any Anthropic-API-compatible endpoint via ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN / ANTHROPIC_MODEL (documented by third-party providers like Moonshot's Kimi). This works well in a plain terminal session.
However, the managed/GUI app experience does not expose this same flexibility. As a non-developer user who occasionally hits my Claude usage limits, I wanted a lightweight way to fall back to a cheaper/alternative model provider for low-stakes work (transcription, formatting, drafts) while keeping Claude for everything else, without losing my current conversation context.
Describe the solution you'd like
Some way to switch the active model provider for an existing/managed app session, either:
- A /model (or new /provider) option that accepts a custom base URL + model string, scoped to the current session only, or
- Official support for carrying over a full conversation transcript across a provider switch, inside the managed app itself (currently this only reliably works via the raw CLI's local session storage + claude --continue).
Describe alternatives you've considered
I built a workaround: two custom slash commands (/kimi-on, /kimi-off) that toggle the relevant env vars in ~/.claude/settings.json globally on my machine, plus claude --continue in a terminal to resume the same session under the new provider. It works, but it's global (affects every Claude Code window on the machine, including scheduled automations) and requires closing/reopening windows to take effect — it can't swap the provider live inside an already-open managed app session.
Additional context — a bug I hit while testing this
While the custom provider was toggled ON via settings.json and then OFF again, the managed app's "auto mode" tool-safety classifier got stuck trying to reach the custom model (kimi-k3[1m]) and returned "<model> is temporarily unavailable, so auto mode cannot determine the safety of <tool> right now" for every state-changing tool call (Write, Bash/PowerShell), even though:
- The main conversation model itself kept responding normally as the original Claude model the whole time.
- ~/.claude/settings.json had already been fully reverted (verified by reading the file directly — no Kimi-related keys left).
- Closing and reopening the app window did not clear the stuck state; only the underlying session eventually recovered on its own after a while.
This suggests the auto-mode classifier's model resolution is cached somewhere independent of settings.json, tied to the session rather than the process, and doesn't get invalidated when the provider config changes back. Worth checking, since it turned a reversible experiment into a temporarily broken session
Showing cached comments. Read the full discussion on GitHub ↗
3 Comments
The global-scope problem you hit with
/kimi-onand/kimi-offis structural rather than a gap in your workaround, and it is worth naming because it also shapes what a fix would have to look like.ANTHROPIC_BASE_URL,ANTHROPIC_AUTH_TOKENandANTHROPIC_MODELare read from the process environment and from~/.claude/settings.json, both of which are machine-wide. So there is no way to express "this window on Kimi, that window on Anthropic" through them, no matter how the toggle is written. Anything per-session has to carry the provider identity somewhere the environment cannot flatten.What works is making the token the routing key instead of the base URL. Point the base URL at a small local endpoint once, give each session its own token, and have that endpoint resolve token to provider to real key. The provider then travels with the session rather than with the machine, several can run at once, and switching one does not disturb the scheduled automations you mention. Two things to watch if you build it: the model name has to be rewritten in flight, because Claude Code sends
claude-opus-5and Moonshot rejects it outright, and/v1/messages/count_tokensgets called constantly and is worth answering locally rather than forwarding.On the classifier part of your report, I would keep that as its own issue. I have not reproduced it, so I would rather not guess at the cause here, but a stale provider surviving a full revert of
settings.jsonis a distinct bug from the feature request and will get lost as "additional context".Disclosure: I ship a paid Windows app that does the per-instance version of this for Claude Desktop, so I have an interest here. The token-routing mechanism above is the part worth having either way, and it does not need my app.
Yeah very disappointed in the lack of support here.
+1. Claude Desktop (Code tab) always injects ANTHROPIC_BASE_URL=https://api.anthropic.com, so a local proxy set in settings.json is ignored. The only official route is Third-Party Inference gateway mode, which drops the claude.ai subscription login and needs an API key.
Request: let the Desktop Code tab honor ANTHROPIC_BASE_URL from settings.json while keeping the subscription login, like the terminal CLI does.