feat(proxy): add /v1/models endpoint for gateway model discovery#128
Open
jsboige wants to merge 1 commit into
Open
feat(proxy): add /v1/models endpoint for gateway model discovery#128jsboige wants to merge 1 commit into
jsboige wants to merge 1 commit into
Conversation
Returns all routable models from routing rules, profile model mappings, custom endpoints, and --model flag. Claude Code uses this endpoint when CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 is set. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
c73d2d6 to
c935f3a
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.
Summary
GET /v1/modelsendpoint to the proxy server--modelflagCLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1)Details
The endpoint aggregates models from four sources:
DEFAULT_ROUTING_RULES+ user config (catch-all*excluded)--model-mapor configcustomEndpoints[].modelsfrom~/.claudish/config.json--modelflag if setResponse format follows the OpenAI
/v1/modelsconvention:{ "object": "list", "data": [ { "id": "claude-sonnet-4-20250514", "display_name": "claude-sonnet-4-20250514", "created_at": "..." }, ... ] }Zero new dependencies — uses only existing imports (
loadConfig,loadRoutingRules). Config read failures for custom endpoints are silently skipped (proxy stays up).Test plan
bun run build— compiles without errorscurl http://localhost:3000/v1/models— returns model listCLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1Claude Code session uses the endpoint correctly🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com