Skip to content

Run the Claude Code harness against a non-Claude model (Fireworks / Kimi) — model diversity without a new runtime #491

Description

@vikasprogrammer

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 FireConnectfireconnect claude on; default aliases map to glm-fast-latest, kimi-fast-latest, deepseek-v4-flash (docs)
  • Kimi / Moonshothttps://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:

  1. 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.)
  2. 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.
  3. A stale ~/.claude/settings.json overrides terminal env. Relevant because our launcher already writes .claude/aos-settings.json and passes it via --settings.
  4. 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.
  5. 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.
  6. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions