fix(api): pass base_url to OpenAI client in test endpoint to prevent UnsupportedProtocol error

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-23 18:54:14 +00:00
parent 5979a7bbcb
commit d885b63d38
2 changed files with 34 additions and 2 deletions
+4 -2
View File
@@ -53,8 +53,10 @@ async def test_openai_connection(request: Request):
logger.warning("No OpenAI API key configured")
return {"status": "error", "message": "No OpenAI API key is configured"}
# Configure the client
client = openai.OpenAI(api_key=settings.openai_api_key)
# Configure the client, explicitly passing base_url so the sanitized
# value from Settings (strip_outer_quotes) is used instead of the raw
# OPENAI_BASE_URL env var which may contain literal quote characters.
client = openai.OpenAI(api_key=settings.openai_api_key, base_url=settings.openai_base_url)
# Try to make a simple request to validate the key
try: