feat: expose model groups in /v1/models endpoint
Add Groups() method to Router so handleListModels can append model group IDs (e.g. 'deepseek-auto', 'openai-auto') to the model list, marked with owned_by: 'gophergate'. This lets clients discover and use groups via the standard OpenAI /v1/models endpoint.
This commit is contained in:
@@ -467,6 +467,20 @@ func (s *Server) handleListModels(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// Add model groups so clients can discover them
|
||||
if s.modelRouter != nil {
|
||||
for _, gid := range s.modelRouter.Groups() {
|
||||
if _, exists := modelMap[gid]; !exists {
|
||||
modelMap[gid] = OpenAIModel{
|
||||
ID: gid,
|
||||
Object: "model",
|
||||
Created: 1700000000,
|
||||
OwnedBy: "gophergate",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var data []OpenAIModel
|
||||
for _, m := range modelMap {
|
||||
data = append(data, m)
|
||||
|
||||
Reference in New Issue
Block a user