Skip to content

Add ucode claude --model to pin a custom Databricks model - #306

Merged
AarushiShah-db merged 3 commits into
mainfrom
claude-model-flag
Aug 10, 2026
Merged

Add ucode claude --model to pin a custom Databricks model#306
AarushiShah-db merged 3 commits into
mainfrom
claude-model-flag

Conversation

@AarushiShah-db

@AarushiShah-db AarushiShah-db commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

ucode claude --model <uc-id> used to fall through to Claude Code's own --model flag, which validates
the name client-side and rejects a raw Databricks id ("It may not exist or you may not have access to it.
Run /model to pick a different model"). Codex works because its --model passes straight to the
gateway.

Adds a real --model option to ucode claude. The id is pinned into the family-alias env vars
(ANTHROPIC_DEFAULT_OPUS/SONNET/HAIKU_MODEL), not ANTHROPIC_MODEL — Claude Code validates the latter
client-side (on ucode's apiKeyHelper auth path) and rejects a raw id, but passes the aliases through
unchecked to the gateway. A raw id carries no signal of its family, so it's pinned into all three slots,
guaranteeing it takes effect whichever slot Claude Code resolves (root session, tier switch, or
subagent). Threaded as a new custom_model arg through configure_toolwrite_tool_config
render_overlay.

--model outranks the managed default and smart-routing pick, and is mutually exclusive with
--provider (which routes by header and pins no model).

Also warns when Claude Code's enterprise managed-settings scope (e.g. an Isaac/dbexec-installed
/etc/claude-code/managed-settings.json) pins the Claude model — that scope outranks the --settings
file ucode writes and can't be excluded, so it silently overrides --model. The warning names the file
and explains why the requested model didn't take effect.

Verified end-to-end against a live workspace: with the aliases set, claude launches on the custom
model; and the enterprise-settings case is what surfaced the need for the warning.

Screenshot 2026-08-10 at 12 41 11 PM Screenshot 2026-08-10 at 12 42 37 PM

`ucode claude --model <uc-id>` used to fall through to Claude Code's own
--model flag, which validates the name client-side against the models it lists
and rejects a raw Databricks id ("may not exist ... run /model to pick a
different model"). Codex works because its --model goes straight to the
gateway.

Add a real --model option to `ucode claude` that pins the id via
ANTHROPIC_MODEL (route_root_model) — the same path smart routing and managed
configs already use — so the gateway resolves any UC model id. An explicit
--model outranks the managed default and smart-routing pick, and can't be
combined with --provider (which routes by header and pins no model).

Co-authored-by: Isaac
The first cut pinned --model as ANTHROPIC_MODEL, which didn't fix the bug:
Claude Code validates ANTHROPIC_MODEL client-side (on ucode's apiKeyHelper auth
path) and rejects a raw Databricks id with the same "may not exist ... run
/model" error. Verified against the live gateway that the id resolves fine —
the rejection is purely Claude Code's client-side check.

The family-alias env vars (ANTHROPIC_DEFAULT_OPUS/SONNET/HAIKU_MODEL) are passed
through unchecked, so route --model there instead. A raw id carries no signal
of its family, so pin it into all three aliases — the model then takes effect
whichever slot Claude Code resolves (root session, tier switch, or subagent).
Threaded as a new `custom_model` arg through configure_tool → write_tool_config
→ render_overlay, distinct from ANTHROPIC_MODEL (which stays unset).

Co-authored-by: Isaac
Claude Code's enterprise managed-settings scope (e.g. an Isaac/dbexec-installed
/etc/claude-code/managed-settings.json) pins the Claude model and outranks both
the --settings file ucode writes and --setting-sources exclusion. So `--model`
is silently ignored on such machines and the launch runs the pinned model —
which looks like a ucode bug.

Warn at launch when --model is passed for claude and the enterprise settings
pin a model, naming the file and telling the user to edit/remove it. The prior
managed-settings warning only fired under a workspace managed config; a plain
`ucode claude --model` launch got nothing.

Co-authored-by: Isaac
@AarushiShah-db
AarushiShah-db merged commit 5f0d5ec into main Aug 10, 2026
2 checks passed
@AarushiShah-db
AarushiShah-db deleted the claude-model-flag branch August 10, 2026 19:48
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