fix: 修复 Gemini 风格 /v1/models 列表请求 (#6199)

* fix: support Gemini model listing on v1 route

* test: cover Gemini query key model listing
This commit is contained in:
zhibisora
2026-08-11 14:49:20 +08:00
committed by GitHub
parent ffeb1b24ef
commit 3d5dc36f1d
3 changed files with 129 additions and 2 deletions
+2 -1
View File
@@ -374,7 +374,8 @@ func TokenAuth() func(c *gin.Context) {
}
}
// gemini api 从query中获取key
if strings.HasPrefix(c.Request.URL.Path, "/v1beta/models") ||
if c.Request.URL.Path == "/v1/models" ||
strings.HasPrefix(c.Request.URL.Path, "/v1beta/models") ||
strings.HasPrefix(c.Request.URL.Path, "/v1beta/openai/models") ||
strings.HasPrefix(c.Request.URL.Path, "/v1/models/") {
skKey := c.Query("key")