Ver código fonte

chore: add additional headers only for Openrouter

Alok Saboo 11 meses atrás
pai
commit
bd82334647
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3 3
      backend/apps/openai/main.py

+ 3 - 3
backend/apps/openai/main.py

@@ -116,9 +116,9 @@ async def speech(request: Request, user=Depends(get_verified_user)):
         headers = {}
         headers["Authorization"] = f"Bearer {app.state.OPENAI_API_KEYS[idx]}"
         headers["Content-Type"] = "application/json"
-        headers['HTTP-Referer'] = "https://openwebui.com/"
-        headers['X-Title'] = "Open WebUI"
-
+        if "openrouter.ai" in app.state.OPENAI_API_BASE_URLS[idx]:
+            headers['HTTP-Referer'] = "https://openwebui.com/"
+            headers['X-Title'] = "Open WebUI"
         r = None
         try:
             r = requests.post(