MPS: forward --model to Claude Code for a relayed provider - #427
Open
masonc08 wants to merge 1 commit into
Open
Conversation
masonc08
force-pushed
the
masonc08/mps-relayed-honor-model
branch
from
August 31, 2026 23:46
1deedf2 to
c059e66
Compare
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
force-pushed
the
masonc08/mps-relayed-honor-model
branch
from
August 31, 2026 23:58
c059e66 to
a2754bd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/modelpicker (limited list) or editingsettings.json(blocked under MDM).What we learned
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.allow_all_targetswith no declared Claude targets. So there's nothing for ucode to resolve--modelagainst — an approach that pins the gateway env from declared targets can't help them.--model:ucode claude --provider <mps> -- --model opusalready launches on Opus via the subscription (verified e2e against a relayed Enterprise MPS on staging).Change
For a relayed provider, forward
--modelto Claude Code's own--modellaunch arg — exactly what the-- --model Xpassthrough does, now automatic. Claude Code selects the model natively and the relay honors it; no declared targets required, and it sidesteps theANTHROPIC_MODELclient-side check (we use Claude Code's native flag). A--modelthat 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 withnot relayed, and inject--modelinto the launch args for a relayed provider (surfaced in the launch summary via the existingforwarded_model).Testing
test_cli.pyrelayed cases (forwarded-to-Claude-Code, and no---modelforwards nothing); the provider suites,test_agents_init,test_databricks,test_agent_claudegreen (729).ruffclean.ucode claude --provider <relayed_enterprise_mps> --model opuslaunches on Opus (matches the proven-- --model opuspassthrough).This pull request and its description were written by Isaac.