IntermediatePlatform / AI Eng

Mixed Multi-Vendor Model Stack: Opus Plans, Qwen / DeepSeek Execute

Pin top models from different vendors per agent role — planning keeps Anthropic Opus, execution lands on Qwen Plus / DeepSeek V3, with zero client change and automatic cross-protocol translation.

What the community actually complains about

Running Claude Code on Claude Opus end-to-end is too expensive; a blanket drop to Sonnet visibly degrades planning and architectural judgment, and rework gets more costly. Developers want to mix top models from other vendors (Qwen, DeepSeek), but the client only speaks the Anthropic protocol and claude-* model names, and changing config means touching every dev machine.

Worse, the plan loop, the main execution loop, and batch subtasks have genuinely different needs for capability vs. price — a single model switch on the client cannot match that.

How GateLLM does it

GateLLM rewrites the model name by identity after the ingress gate and before routing — zero client change. Planning and architectural judgment keep claude-opus-4 going straight to Anthropic; the main execution loop's claude-sonnet-* maps to DashScope's qwen-plus; batch subtasks (formatting, commit messages, retrieval summaries) map to deepseek-v3 via an OpenAI-compatible upstream. Cross-protocol translation is handled by the gateway, with SSE streams and tool_call_id preserved on the round trip.

Rules attach to access keys or key groups and take effect per team; the egress gate verifies the target is in the identity's allowlist — configuring a mapping is not granting permission.

5 levers that actually land

  • Identity-scoped model mapping: from → to on access keys / key groups, rewritten after ingress and before routing; supports a single * capturing a middle segment, hot-reloaded
  • Cross-protocol translation: Claude Code on Anthropic, Codex / OpenAI SDK on OpenAI, the gateway translates to DashScope / OpenAI / Gemini / Bedrock upstreams; :keep-alive on long upstream inference, _gateway_warning on stream break
  • Request-header conditional routing: the same from routes to different targets by X-Tenant etc. (exact / prefix / regex / exists / absent); conditional rules first, unconditional fallback, first-match-wins — usable for canary
  • Plan-mode detection: Claude Code's plan mode injects Plan mode is active / Exited Plan Mode markers; a script comparing the last position switches routing — planning on Opus, execution on the cost-efficient model
  • Permission & observability: the egress gate verifies the target is in the identity allowlist (mapping ≠ permission); the log model column shows an MM tag with the original → mapped name on hover; stats and billing attribute by the post-mapping real model name, so the mixed stack's cost is comparable at a glance
Full how-to: Configure identity-scoped model mapping (docs)

FAQ