From 10647ebfcb365fc7990b72788bc78e74705489ba Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 29 Oct 2026 14:20:10 -0700 Subject: [PATCH] fix(openai): raise the SDK's own missing-credentials error so callers keep its class and status --- litellm/llms/openai/common_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/openai/common_utils.py b/litellm/llms/openai/common_utils.py index 507368bba9e..ffaf987d44e 100644 --- a/litellm/llms/openai/common_utils.py +++ b/litellm/llms/openai/common_utils.py @@ -164,7 +164,7 @@ def openai_sdk_key_params(api_key: str | None) -> OpenAISdkKeyParams: if not _SDK_READS_ADMIN_KEY_ENV: return {"api_key": api_key} if not api_key: - raise OpenAIError(status_code=401, message=_MISSING_OPENAI_API_KEY_MESSAGE) + raise openai.OpenAIError(_MISSING_OPENAI_API_KEY_MESSAGE) return {"api_key": api_key, "admin_api_key": api_key}