feat: add conditional setting for HTTP headers in OpenRouter channel type

This commit is contained in:
CaIon
2026-03-12 19:05:25 +08:00
parent 3bd1a167c9
commit 4e1b05e987

View File

@@ -225,9 +225,13 @@ func (a *Adaptor) SetupRequestHeader(c *gin.Context, header *http.Header, info *
} }
} }
if info.ChannelType == constant.ChannelTypeOpenRouter { if info.ChannelType == constant.ChannelTypeOpenRouter {
if header.Get("HTTP-Referer") == "" {
header.Set("HTTP-Referer", "https://www.newapi.ai") header.Set("HTTP-Referer", "https://www.newapi.ai")
}
if header.Get("X-OpenRouter-Title") == "" {
header.Set("X-OpenRouter-Title", "New API") header.Set("X-OpenRouter-Title", "New API")
} }
}
return nil return nil
} }