Support custom Claude model endpoints via --model-prefix#128
Open
hackerrdave wants to merge 1 commit into
Open
Support custom Claude model endpoints via --model-prefix#128hackerrdave wants to merge 1 commit into
hackerrdave wants to merge 1 commit into
Conversation
ucode discovered Claude models only by the hardcoded `databricks-claude-<family>-` name and pinned the newest per family. Workspaces that serve Claude through custom endpoints (e.g. Bedrock-backed `acme-bedrock-claude-opus-4-8`) found no models. Add a `--model-prefix` flag to `ucode configure` for the shared prefix before the family token. It fits the CLI's existing `--agents`/`--workspaces` idiom and is self-documented in `--help`. Setting a Bedrock prefix scopes discovery to those endpoints and excludes hosted `databricks-claude-*` models, which no longer match the prefix. Default stays `databricks-claude-` (unchanged). - discover_claude_models now returns (defaults, allowed, reason): newest match per family is the default; every matching endpoint stays in the allowlist so additional versions remain selectable. - Persist the allowlist (claude_allowed_models) and resolved prefix (claude_model_prefix) as sibling state keys to keep the flat claude_models shape its existing consumers rely on. Precedence: flag > persisted > default, so the flag is only needed on the first configure for a workspace. - Write the allowlist (endpoint ids + family aliases) to Claude Code's `availableModels` setting so the /model picker is restricted to the discovered models; the gateway remains the hard backstop. - ucode status surfaces the resolved prefix, per-family defaults, extra versions, and selectable-model count. - Document --model-prefix in the README. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
ucodediscovered Claude models only by the hardcodeddatabricks-claude-<family>-name and pinned the newest one per family. Workspaces that serve Claude through custom serving endpoints — e.g. Bedrock-backed models namedacme-bedrock-claude-opus-4-8on the AI Gateway anthropic route — matched nothing, so Claude couldn't be configured.What changed
--model-prefixflag. Configure custom Claude endpoints by their shared prefix before the family token. Fits the CLI's existing--agents/--workspaces"configure without prompting" idiom and is self-documented inucode configure --help. Setting a Bedrock prefix scopes discovery to those endpoints and excludes hosteddatabricks-claude-*models, since they no longer match the prefix. Default staysdatabricks-claude-(existing behavior unchanged).claude_model_prefixstate key, so the flag only needs to be passed on the firstconfigurefor a workspace. Precedence:--model-prefixflag > persisted state > default.discover_claude_modelsnow returns(defaults, allowed, reason). The newest match per family is the default; every matching endpoint stays selectable. Stored as sibling state keys (claude_allowed_models,claude_model_prefix) so the flatclaude_modelsshape its existing consumers rely on is untouched.availableModelssetting so the/modelpicker is restricted to the discovered models. The Databricks gateway remains the hard backstop.ucode statussurfaces the resolved prefix, per-family defaults, extra versions, and selectable-model count.--model-prefix.Usage
Testing
uv run pytest(621 passed, 27 skipped) anduv run ruff check .clean. Tests cover prefix scoping / hosted exclusion, prefix-resolution precedence, the--model-prefixflag threading into discovery and persisting,availableModelscontents, and thestatusrendering.🤖 Generated with Claude Code