Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ BYTEZ_CHAT_URL = "https://api.bytez.com/models/v2/openai/v1/chat/completions"
|
|
| 14 |
BYTEZ_MODELS_URL = "https://api.bytez.com/models/v2/list/models"
|
| 15 |
BYTEZ_AUTH = os.getenv("BYTEZ_API_KEY") # your Bytez key
|
| 16 |
LOCAL_API_KEY = os.getenv("LOCAL_API_KEY") # optional local guard
|
| 17 |
-
|
| 18 |
# ---------------------------------------------------------------------
|
| 19 |
# FastAPI app
|
| 20 |
# ---------------------------------------------------------------------
|
|
@@ -160,8 +160,8 @@ async def v2_chat_completions(request: Request, authorization: str = Header(None
|
|
| 160 |
|
| 161 |
check_key(authorization)
|
| 162 |
|
| 163 |
-
if not
|
| 164 |
-
raise HTTPException(status_code=500, detail="Server
|
| 165 |
|
| 166 |
try:
|
| 167 |
body = await request.body()
|
|
@@ -172,7 +172,7 @@ async def v2_chat_completions(request: Request, authorization: str = Header(None
|
|
| 172 |
stream = payload.get("stream", False)
|
| 173 |
|
| 174 |
upstream_headers = {
|
| 175 |
-
"Authorization":
|
| 176 |
"Content-Type": "application/json",
|
| 177 |
}
|
| 178 |
|
|
|
|
| 14 |
BYTEZ_MODELS_URL = "https://api.bytez.com/models/v2/list/models"
|
| 15 |
BYTEZ_AUTH = os.getenv("BYTEZ_API_KEY") # your Bytez key
|
| 16 |
LOCAL_API_KEY = os.getenv("LOCAL_API_KEY") # optional local guard
|
| 17 |
+
BYTEZ_AUTH_2 = os.getenv("BYTEZ_API_KEY_2")
|
| 18 |
# ---------------------------------------------------------------------
|
| 19 |
# FastAPI app
|
| 20 |
# ---------------------------------------------------------------------
|
|
|
|
| 160 |
|
| 161 |
check_key(authorization)
|
| 162 |
|
| 163 |
+
if not BYTEZ_AUTH_2:
|
| 164 |
+
raise HTTPException(status_code=500, detail="Server BYTEZ_API_2 not configured")
|
| 165 |
|
| 166 |
try:
|
| 167 |
body = await request.body()
|
|
|
|
| 172 |
stream = payload.get("stream", False)
|
| 173 |
|
| 174 |
upstream_headers = {
|
| 175 |
+
"Authorization": BYTEZ_AUTH_2,
|
| 176 |
"Content-Type": "application/json",
|
| 177 |
}
|
| 178 |
|