From 4e1b05e987077ae763c9d8c8407f002a2e43f992 Mon Sep 17 00:00:00 2001 From: CaIon Date: Thu, 12 Mar 2026 19:05:25 +0800 Subject: [PATCH] feat: add conditional setting for HTTP headers in OpenRouter channel type --- relay/channel/openai/adaptor.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/relay/channel/openai/adaptor.go b/relay/channel/openai/adaptor.go index 34d4952e7..29a8f3494 100644 --- a/relay/channel/openai/adaptor.go +++ b/relay/channel/openai/adaptor.go @@ -225,8 +225,12 @@ func (a *Adaptor) SetupRequestHeader(c *gin.Context, header *http.Header, info * } } if info.ChannelType == constant.ChannelTypeOpenRouter { - header.Set("HTTP-Referer", "https://www.newapi.ai") - header.Set("X-OpenRouter-Title", "New API") + if header.Get("HTTP-Referer") == "" { + header.Set("HTTP-Referer", "https://www.newapi.ai") + } + if header.Get("X-OpenRouter-Title") == "" { + header.Set("X-OpenRouter-Title", "New API") + } } return nil }