diff --git a/backend/open_webui/routers/openai.py b/backend/open_webui/routers/openai.py index ce290d09b2..0c0228cb52 100644 --- a/backend/open_webui/routers/openai.py +++ b/backend/open_webui/routers/openai.py @@ -1206,7 +1206,10 @@ async def generate_chat_completion( error_json = json.loads(error_body) return JSONResponse(status_code=r.status, content=error_json) except json.JSONDecodeError: - return PlainTextResponse(status_code=r.status, content=error_body) + return JSONResponse( + status_code=r.status, + content={"error": {"message": error_body, "code": r.status}}, + ) streaming = True return StreamingResponse(