Skip to content

feat: improve /v1/models endpoint with OpenAI-compatible fields and per-provider filtering#7

Merged
prasadus92 merged 3 commits into
prasadus92:mainfrom
gnodet:feat/models-endpoint-improvements
Jun 6, 2026
Merged

feat: improve /v1/models endpoint with OpenAI-compatible fields and per-provider filtering#7
prasadus92 merged 3 commits into
prasadus92:mainfrom
gnodet:feat/models-endpoint-improvements

Conversation

@gnodet

@gnodet gnodet commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Improve the /v1/models endpoint to be more compatible with OpenAI clients and add per-provider model listing.

Depends on: #6 (recent Claude models) — includes that commit as a base.

Changes

1. OpenAI-compatible model object fields

Add created and owned_by fields to the model objects returned by /v1/models. Many OpenAI client libraries (Python openai, 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 models
  • GET /gemini/v1/models — lists only Google Gemini models
  • GET /openai/v1/models — lists all MaaS partner models (Kimi, GLM, Qwen, Grok, etc.)

The root GET /v1/models continues to return all models across all providers.

Testing

Verified with curl and the Python openai client library. All endpoints return well-formed responses.

gnodet added 3 commits June 5, 2026 02:22
…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.
@gnodet gnodet force-pushed the feat/models-endpoint-improvements branch from 89cfb12 to 7288dad Compare June 5, 2026 00:23
@prasadus92 prasadus92 merged commit 7288dad into prasadus92:main Jun 6, 2026
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.

2 participants