This commit is contained in:
dafit
2026-04-02 20:10:34 +02:00
parent 3926ab676f
commit 10131a715b
99 changed files with 300 additions and 6896 deletions

View File

@@ -203,9 +203,10 @@ async def chat_completions(request: Request):
api_key = upstream_config.get("api_key", os.environ.get("OPENROUTER_API_KEY", ""))
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
}
if api_key:
headers["Authorization"] = f"Bearer {api_key}"
# Copy relevant headers from original request
for header in ["HTTP-Referer", "X-Title"]:
@@ -261,9 +262,10 @@ async def completions(request: Request):
api_key = upstream_config.get("api_key", os.environ.get("OPENROUTER_API_KEY", ""))
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
}
if api_key:
headers["Authorization"] = f"Bearer {api_key}"
response = await http_client.post(
f"{upstream_url}/completions",