From a3094ac16896ad714149f4314b8e96533839d305 Mon Sep 17 00:00:00 2001 From: ryan delin <7461677+ahostbr@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:17:33 -0500 Subject: [PATCH] fix(api): include full model metadata in /v1/models response 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 --- sdk/api/handlers/openai/openai_handlers.go | 27 ++++------------------ 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/sdk/api/handlers/openai/openai_handlers.go b/sdk/api/handlers/openai/openai_handlers.go index 2e85dcf851..be8ec2f014 100644 --- a/sdk/api/handlers/openai/openai_handlers.go +++ b/sdk/api/handlers/openai/openai_handlers.go @@ -59,34 +59,15 @@ func (h *OpenAIAPIHandler) Models() []map[string]any { // OpenAIModels handles the /v1/models endpoint. // It returns a list of available AI models with their capabilities // and specifications in OpenAI-compatible format. +// All metadata from the model registry is included so that downstream +// consumers (dashboards, IDEs, proxy UIs) can group and display models +// without maintaining a separate static list. func (h *OpenAIAPIHandler) OpenAIModels(c *gin.Context) { - // Get all available models allModels := h.Models() - // Filter to only include the 4 required fields: id, object, created, owned_by - filteredModels := make([]map[string]any, len(allModels)) - for i, model := range allModels { - filteredModel := map[string]any{ - "id": model["id"], - "object": model["object"], - } - - // Add created field if it exists - if created, exists := model["created"]; exists { - filteredModel["created"] = created - } - - // Add owned_by field if it exists - if ownedBy, exists := model["owned_by"]; exists { - filteredModel["owned_by"] = ownedBy - } - - filteredModels[i] = filteredModel - } - c.JSON(http.StatusOK, gin.H{ "object": "list", - "data": filteredModels, + "data": allModels, }) }