Commit f9c2e1fb by hackerxiao

feat: 支持仅使用x-api-key获取anthropic格式的模型列表

parent ee53a7b6
...@@ -194,7 +194,7 @@ func TokenAuth() func(c *gin.Context) { ...@@ -194,7 +194,7 @@ func TokenAuth() func(c *gin.Context) {
c.Request.Header.Set("Authorization", "Bearer "+key) c.Request.Header.Set("Authorization", "Bearer "+key)
} }
// 检查path包含/v1/messages // 检查path包含/v1/messages
if strings.Contains(c.Request.URL.Path, "/v1/messages") { if strings.Contains(c.Request.URL.Path, "/v1/messages") || strings.Contains(c.Request.URL.Path, "/v1/models") {
anthropicKey := c.Request.Header.Get("x-api-key") anthropicKey := c.Request.Header.Get("x-api-key")
if anthropicKey != "" { if anthropicKey != "" {
c.Request.Header.Set("Authorization", "Bearer "+anthropicKey) c.Request.Header.Set("Authorization", "Bearer "+anthropicKey)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment