Skip to content

Model routing: an orchestrator model with subagents on other providers #1

Description

@ParallelEntrepreneur

Goal. Run a colony's main agent on one model (e.g. Claude Opus on the subscription) and its subagents on another provider, e.g. DeepSeek V4.1 Flash (deepseek-flash) via DeepSeek's Anthropic-compatible API or a locally served model.

Design (docs/protocol.md §6.1, §6.3)

  • Model strings are <provider>/<model-id>; unprefixed models go to Anthropic.
  • The Claude Code runner starts a local router on 127.0.0.1 and points ANTHROPIC_BASE_URL at it. Routed requests get the provider's base URL and credential; Anthropic requests pass through unchanged, so the subscription login keeps working for the orchestrator.
  • CLAUDE_CODE_SUBAGENT_MODEL and ANTHROPIC_DEFAULT_HAIKU_MODEL come from the agent module's subagent_model and background_model settings.
  • Providers live on the mothership (/api/providers), keys stored 0600 and injected as microsandbox secrets for the provider host only. Loopback base URLs are rewritten to host.microsandbox.internal.

Caveats. Anthropic does not support routing Claude Code to non-Claude models; features that depend on Claude-only API behaviour may degrade for subagents on other providers.

Done when

  • A colony with model=opus and subagent_model=deepseek/deepseek-flash completes a task that uses a subagent, and the subagent requests reach DeepSeek.
  • Router unit tests: prefix routing, header rewriting, streaming, count_tokens fallback.
  • Provider keys never appear in a colony's environment or disk.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions