reorg
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user