From f9c2e1fbf2733e00ae8c5c993c670b34fc401068 Mon Sep 17 00:00:00 2001 From: hackerxiao <2945294768@qq.com> Date: Fri, 12 Dec 2025 16:53:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E4=BB=85=E4=BD=BF?= =?UTF-8?q?=E7=94=A8x-api-key=E8=8E=B7=E5=8F=96anthropic=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E5=9E=8B=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- middleware/auth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleware/auth.go b/middleware/auth.go index dc59df9a..40afabfc 100644 --- a/middleware/auth.go +++ b/middleware/auth.go @@ -194,7 +194,7 @@ func TokenAuth() func(c *gin.Context) { c.Request.Header.Set("Authorization", "Bearer "+key) } // 检查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") if anthropicKey != "" { c.Request.Header.Set("Authorization", "Bearer "+anthropicKey)