Idea
Claude Code will talk to any Anthropic-API-compatible endpoint. So we could run a foreign model inside the existing claude-code runtime rather than adding another runtime to CODING_RUNTIMES.
Providers that document this today:
- Fireworks FireConnect —
fireconnect claude on; default aliases map to glm-fast-latest, kimi-fast-latest, deepseek-v4-flash (docs)
- Kimi / Moonshot —
https://api.moonshot.ai/anthropic, kimi-k3 (docs)
It's purely environment configuration:
ANTHROPIC_BASE_URL # the compatible endpoint
ANTHROPIC_AUTH_TOKEN # (Fireworks uses ANTHROPIC_CUSTOM_HEADERS for its key)
ANTHROPIC_MODEL
ANTHROPIC_DEFAULT_OPUS_MODEL
ANTHROPIC_DEFAULT_SONNET_MODEL
ANTHROPIC_DEFAULT_HAIKU_MODEL
ANTHROPIC_DEFAULT_FABLE_MODEL
CLAUDE_CODE_SUBAGENT_MODEL
CLAUDE_CODE_AUTO_COMPACT_WINDOW # optional
CLAUDE_CODE_EFFORT_LEVEL # optional
Why this is attractive
It is not a new runtime. The harness is unchanged, so the PreToolUse gate hook, the OS MCP tool server, skills, sub-agents, the transcript parser, cost, resident chat and take-over all keep working as-is.
Compare adding Codex (#478 → #487): seven PRs, and it still has no attach or resident chat because of Codex's hook-trust behaviour. This is an env-injection feature in terminal/claude-launch.sh plus a per-agent "model provider" setting — days, not weeks — and every governance guarantee comes along for free.
Scope sketch
- A per-agent (and/or workspace-default) model provider config:
{ baseUrl, authTokenSecretKey, models: { main, opus, sonnet, haiku, fable, subagent } }, stored on the manifest like RuntimeTuning.
claude-launch.sh exports the env block above; the auth token resolves through the existing vault/shellSecrets path so it never lands in agent.json.
- Audit which provider a session ran under (extend the existing
session.tuning event).
- Surface it on the agent config card next to the runtime picker (v0.274.0).
Traps to design for
All of these come from the providers' own docs, and each is the silent-failure class this codebase keeps getting bitten by:
- Cost attribution breaks, in the expensive direction.
src/edge/session-cost.ts prices by matching the Claude model name (/opus/, /sonnet/, …) and falls back to Opus rates ($5/$25 per Mtok). A Kimi or GLM run would be billed at Opus prices — wildly wrong. Needs provider-aware rates before the numbers mean anything. (Fireworks documents the same flaw in Claude Code's own /model picker showing Anthropic pricing.)
- Omitting any model-slot var causes silent failures in specific scenarios — Kimi's docs are explicit about this. Set all of them or none; a partial config is worse than no config.
- A stale
~/.claude/settings.json overrides terminal env. Relevant because our launcher already writes .claude/aos-settings.json and passes it via --settings.
- The per-runtime model guard from v0.274.0 rejects
^(gpt|o[0-9]|codex) for claude-code, so a Fireworks gpt-oss-* alias would be refused. glm-* / kimi-* / deepseek-* pass fine, so this is a narrow provider-aware allowance.
- Endpoint feature gaps:
WebFetch is unsupported on the Kimi endpoint, and kimi-k2.7-code requires thinking explicitly enabled or requests fail 400 invalid thinking.
- Worth verifying early that the gate hook still receives normal
tool_name/tool_input through a proxied endpoint — that is the one thing that must not regress, and it's cheap to check with a single governed Bash call.
Status
Backlog / side quest. Not started. Mechanism verified against both providers' docs on 2026-07-30; nothing built.
Idea
Claude Code will talk to any Anthropic-API-compatible endpoint. So we could run a foreign model inside the existing
claude-coderuntime rather than adding another runtime toCODING_RUNTIMES.Providers that document this today:
fireconnect claude on; default aliases map toglm-fast-latest,kimi-fast-latest,deepseek-v4-flash(docs)https://api.moonshot.ai/anthropic,kimi-k3(docs)It's purely environment configuration:
Why this is attractive
It is not a new runtime. The harness is unchanged, so the PreToolUse gate hook, the OS MCP tool server, skills, sub-agents, the transcript parser, cost, resident chat and take-over all keep working as-is.
Compare adding Codex (#478 → #487): seven PRs, and it still has no attach or resident chat because of Codex's hook-trust behaviour. This is an env-injection feature in
terminal/claude-launch.shplus a per-agent "model provider" setting — days, not weeks — and every governance guarantee comes along for free.Scope sketch
{ baseUrl, authTokenSecretKey, models: { main, opus, sonnet, haiku, fable, subagent } }, stored on the manifest likeRuntimeTuning.claude-launch.shexports the env block above; the auth token resolves through the existing vault/shellSecretspath so it never lands inagent.json.session.tuningevent).Traps to design for
All of these come from the providers' own docs, and each is the silent-failure class this codebase keeps getting bitten by:
src/edge/session-cost.tsprices by matching the Claude model name (/opus/,/sonnet/, …) and falls back to Opus rates ($5/$25 per Mtok). A Kimi or GLM run would be billed at Opus prices — wildly wrong. Needs provider-aware rates before the numbers mean anything. (Fireworks documents the same flaw in Claude Code's own/modelpicker showing Anthropic pricing.)~/.claude/settings.jsonoverrides terminal env. Relevant because our launcher already writes.claude/aos-settings.jsonand passes it via--settings.^(gpt|o[0-9]|codex)forclaude-code, so a Fireworksgpt-oss-*alias would be refused.glm-*/kimi-*/deepseek-*pass fine, so this is a narrow provider-aware allowance.WebFetchis unsupported on the Kimi endpoint, andkimi-k2.7-coderequires thinking explicitly enabled or requests fail400 invalid thinking.tool_name/tool_inputthrough a proxied endpoint — that is the one thing that must not regress, and it's cheap to check with a single governedBashcall.Status
Backlog / side quest. Not started. Mechanism verified against both providers' docs on 2026-07-30; nothing built.