Skip to content

MPS: forward --model to Claude Code for a relayed provider - #427

Open
masonc08 wants to merge 1 commit into
mainfrom
masonc08/mps-relayed-honor-model
Open

MPS: forward --model to Claude Code for a relayed provider#427
masonc08 wants to merge 1 commit into
mainfrom
masonc08/mps-relayed-honor-model

Conversation

@masonc08

@masonc08 masonc08 commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Problem

ucode claude --provider <mps> --model <m> is ignored for a relayed (Claude subscription) Model Provider Service. A customer on a Claude Enterprise relay needs to launch on a specific model (e.g. claude-opus-4-8[1m]) without Claude Code's /model picker (limited list) or editing settings.json (blocked under MDM).

What we learned

  • In the AI Gateway relayed Anthropic path (ai-gateway/src/v3/client/ExternalModelDirectClient.scala), the client's model is passed through to Anthropic; Team/Enterprise validates it against the allowlist, personal Max skips that — the gateway never selects a model server-side.
  • Real Enterprise relays are allow_all_targets with no declared Claude targets. So there's nothing for ucode to resolve --model against — an approach that pins the gateway env from declared targets can't help them.
  • The proven lever is Claude Code's own --model: ucode claude --provider <mps> -- --model opus already launches on Opus via the subscription (verified e2e against a relayed Enterprise MPS on staging).

Change

For a relayed provider, forward --model to Claude Code's own --model launch arg — exactly what the -- --model X passthrough does, now automatic. Claude Code selects the model natively and the relay honors it; no declared targets required, and it sidesteps the ANTHROPIC_MODEL client-side check (we use Claude Code's native flag). A --model that already rode in after -- wins. Non-relayed providers (API-key / Bedrock) keep the env-pinning path from #380 unchanged.

The change is cli.py-only: drop the relayed "--model is ignored" warning, guard the env-pinning resolve with not relayed, and inject --model into the launch args for a relayed provider (surfaced in the launch summary via the existing forwarded_model).

Testing

  • Unit: test_cli.py relayed cases (forwarded-to-Claude-Code, and no---model forwards nothing); the provider suites, test_agents_init, test_databricks, test_agent_claude green (729). ruff clean.
  • e2e: ucode claude --provider <relayed_enterprise_mps> --model opus launches on Opus (matches the proven -- --model opus passthrough).

This pull request and its description were written by Isaac.

@masonc08
masonc08 force-pushed the masonc08/mps-relayed-honor-model branch from 1deedf2 to c059e66 Compare August 31, 2026 23:46
@masonc08 masonc08 changed the title MPS: honor --model for a relayed Anthropic service that declares targets MPS: forward --model to Claude Code for a relayed provider Aug 31, 2026
A relayed (Claude Max/Team/Enterprise subscription) Model Provider Service is a
subscription relay: the AI Gateway passes the client's requested model through to
Anthropic and, for Team/Enterprise, validates it against the service's allowlist
(only personal Max skips that) -- it never selects a model server-side. Real
Enterprise relays are allow_all_targets with no declared Claude targets, so there
is nothing for ucode to resolve --model against.

So for a relayed provider, forward --model to Claude Code's own --model flag --
exactly what 'ucode claude --provider <mps> -- --model X' already does, now
automatic. Claude Code selects the model natively and the relay honors it.
Non-relayed providers (API-key / Bedrock) keep the env-pinning path unchanged.

Verified end-to-end against a relayed Enterprise MPS: '-- --model opus' launches
on Opus via the subscription.

Co-authored-by: Isaac <no-reply@databricks.com>
@masonc08
masonc08 force-pushed the masonc08/mps-relayed-honor-model branch from c059e66 to a2754bd Compare August 31, 2026 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant