Skip to content

claude: enable Claude Code native gateway model discovery - #347

Open
andy-xu-db wants to merge 1 commit into
mainfrom
claude/native-model-discovery
Open

claude: enable Claude Code native gateway model discovery#347
andy-xu-db wants to merge 1 commit into
mainfrom
claude/native-model-discovery

Conversation

@andy-xu-db

Copy link
Copy Markdown
Collaborator

Summary

Sets CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 in render_overlay so Claude Code's /model picker lists every gateway Messages-API endpoint — not just the ANTHROPIC_DEFAULT_* family aliases ucode injects today.

Why

Claude Code has native gateway model discovery: when enabled, it fetches GET {ANTHROPIC_BASE_URL}/v1/models and adds a picker row for each returned id (filtered to ids containing claude or anthropic). ucode already sets CLAUDE_CODE_USE_GATEWAY=1 but never turned on discovery, so the picker only shows the family-alias rows. This flag makes custom Model Serving endpoints whose ids carry claude/anthropic (e.g. main.default.my_anthropic_ms, system.ai.claude-opus-4-8) appear and route natively as 3-part FQNs.

What changed

  • render_overlay sets the flag, gated not provider: a Model Provider Service routes every request to the external provider via header, so a discovered gateway endpoint id would reach a provider that can't resolve it — discovery is off in that mode.
  • Relayed launches work: the loopback refresh proxy (gateway_proxy.py) forwards /v1/models to the gateway.

Testing

  • 2 new tests in test_agent_claude.py: flag is set on a normal launch; skipped under provider.
  • Full test_agent_claude.py suite passes (102 tests).

This pull request and its description were written by Isaac.

Set CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 in render_overlay so the
/model picker lists every gateway Messages-API endpoint, not just the
ANTHROPIC_DEFAULT_* family aliases. Skipped under a Model Provider Service:
its routing header would send a discovered gateway id to a provider that
can't resolve it.

Co-authored-by: Isaac
@andy-xu-db
andy-xu-db requested a review from lilly-luo August 17, 2026 21:35
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