fix(api): include full model metadata in /v1/models response#417
fix(api): include full model metadata in /v1/models response#417ahostbr wants to merge 1 commit intorouter-for-me:mainfrom
Conversation
The OpenAI /v1/models endpoint was stripping all metadata except id, object, created, and owned_by. The model registry already provides rich fields (type, display_name, context_length, max_completion_tokens, supported_parameters, supported_endpoints) via convertModelToMap, and the Claude /v1/models endpoint already returns them all. This caused downstream consumers (dashboards, IDEs, proxy UIs) to be unable to group models by provider or show capabilities without maintaining a separate hardcoded model list. Now the endpoint passes through all fields from the registry, matching the behavior of the Claude models endpoint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the /v1/models OpenAI-compatible endpoint to return the full model metadata from the model registry, rather than a filtered subset of fields. This is achieved by removing the filtering logic within the OpenAIModels handler in sdk/api/handlers/openai/openai_handlers.go. The change makes the endpoint's response richer and more useful for downstream applications, and aligns its behavior with other model endpoints in the service. The change is additive and should not break existing clients. The implementation is a straightforward removal of now-unnecessary code.
Summary
The
/v1/modelsendpoint (OpenAI-compatible) was stripping all metadata exceptid,object,created, andowned_by. Meanwhile:convertModelToMap("openai")already provides rich fields:type,display_name,context_length,max_completion_tokens,supported_parameters,supported_endpoints/v1/modelsendpoint (ClaudeModels) already returns all fields without filteringThis forced downstream consumers (dashboards, IDEs, proxy UIs) to maintain separate hardcoded model lists instead of fetching from the API — because the API didn't return enough metadata to group models by provider (
type) or display human-readable names (display_name).Changes
sdk/api/handlers/openai/openai_handlers.go: Remove the filtering loop inOpenAIModels()that stripped fields down to only 4. Now passes through all fields fromModels()(which callsregistry.GetAvailableModels("openai")), matching the Claude handler behavior.Before
{ "object": "list", "data": [ {"id": "gpt-5.4", "object": "model", "created": 1780000000, "owned_by": "openai"} ] }After
{ "object": "list", "data": [ { "id": "gpt-5.4", "object": "model", "created": 1780000000, "owned_by": "openai", "type": "openai", "display_name": "GPT 5.4", "context_length": 1050000, "max_completion_tokens": 100000 } ] }Backwards Compatibility
id,object,created,owned_by) are still present