Skip to content

bridge: route unknown models to claude runtime for ANTHROPIC_MODEL users #167

Description

@honghaoaa1230

Problem

When users connect via kittylitter and use third-party models through ANTHROPIC_MODEL (DeepSeek, OpenRouter, Mimo, etc.), selecting those models in Litter fails because:

  1. runtime_for_model_hint() does not recognize third-party model names (e.g., deepseek-v4-pro[1m], mimo-v2) — they route to "codex" by default instead of "claude"
  2. runtime_for_thread_start() has no fallback: when both resolve_model_selection() and runtime_for_model_hint() return None, it always defaults to "codex", even when the claude runtime is connected

Proposed fix

Two changes in shared/rust-bridge/codex-mobile-client/src/mobile_client/mod.rs:

1. Add common third-party provider patterns to runtime_for_model_hint()

_ if normalized.contains("deepseek") => Some("claude".to_string()),
_ if normalized.contains("openrouter") => Some("claude".to_string()),

2. Add claude runtime fallback in runtime_for_thread_start()

When no model hint matches, check if the claude runtime is connected and prefer it over the codex default:

if let Ok(session) = self.get_session(server_id) {
    let runtimes = session.runtime_kinds();
    if runtimes.iter().any(|k| k == "claude") {
        return "claude".to_string();
    }
}
"codex".to_string()

Why this is safe

  • The fallback only activates when claude runtime is explicitly connected
  • The existing explicit runtime override (explicit_runtime_kind) still takes priority
  • Model names not in available_models are passed through unchanged to the host, where Claude Code handles them via ANTHROPIC_MODEL

Related

Companion fix needed in dnakov/alleycat: the Claude bridge model/list handler should advertise ANTHROPIC_MODEL env var values so custom models appear in the Litter model picker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions