chore: add additional headers only for Openrouter

This commit is contained in:
Alok Saboo 2024-05-13 08:28:24 -04:00
parent 6671e5f170
commit bd82334647

View File

@ -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"
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(