feat: improve /v1/models endpoint with OpenAI-compatible fields and per-provider filtering#7
Merged
prasadus92 merged 3 commits intoJun 6, 2026
Conversation
…validation Add model aliases for recently released Claude models: - Claude Opus 4.6, 4.7, 4.8 (no @Date suffix) - Claude Sonnet 4.6 (no @Date suffix) - Claude Sonnet 4 (claude-sonnet-4-20250514) Fix model validation in _handle_anthropic(): the previous check `if "@" not in vertex_model` rejects models without a @Date suffix. Replace with a lookup against known aliases so both formats work.
OpenAI-compatible clients expect 'created' and 'owned_by' fields in model listings. Set owned_by to the actual provider (anthropic, google, or the MaaS publisher name).
Clients that set base_url to /anthropic or /gemini now get model listings from their respective prefix: GET /anthropic/v1/models → anthropic models only GET /gemini/v1/models → gemini models only GET /gemini/v1beta/models → gemini models only This fixes Hermes showing '0 models' for vertex-anthropic provider.
89cfb12 to
7288dad
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
Improve the
/v1/modelsendpoint to be more compatible with OpenAI clients and add per-provider model listing.Changes
1. OpenAI-compatible model object fields
Add
createdandowned_byfields to the model objects returned by/v1/models. Many OpenAI client libraries (Pythonopenai, LangChain, LiteLLM, etc.) expect these fields and may warn or fail when they are missing.{ "id": "claude-sonnet-4-5", "object": "model", "created": 1719792000, "owned_by": "anthropic" }2. Per-provider model listing endpoints
Add filtered model listing endpoints so clients can discover which models are available for each provider:
GET /anthropic/v1/models— lists only Anthropic Claude modelsGET /gemini/v1/models— lists only Google Gemini modelsGET /openai/v1/models— lists all MaaS partner models (Kimi, GLM, Qwen, Grok, etc.)The root
GET /v1/modelscontinues to return all models across all providers.Testing
Verified with
curland the Pythonopenaiclient library. All endpoints return well-formed responses.