Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: add type hints for APIError and AnthropicError status codes

Krrish Dholakiadb65a5a70fb4
diff --git a/litellm/exceptions.py b/litellm/exceptions.py
index 197e64c7589..0abe3e33afb 100644
--- a/litellm/exceptions.py
+++ b/litellm/exceptions.py
@@ -543,7 +543,7 @@ class InternalServerError(openai.InternalServerError): # type: ignore
class APIError(openai.APIError): # type: ignore
def __init__(
self,
- status_code,
+ status_code: int,
message,
llm_provider,
model,
@@ -754,7 +754,7 @@ class MockException(openai.APIError):
# used for testing
def __init__(
self,
- status_code,
+ status_code: int,
message,
llm_provider,
model,
diff --git a/litellm/llms/anthropic.py b/litellm/llms/anthropic.py
index 2221a3d73f0..e3bc595dd4e 100644
--- a/litellm/llms/anthropic.py
+++ b/litellm/llms/anthropic.py
@@ -72,7 +72,7 @@ class AnthropicConstants(Enum):
class AnthropicError(Exception):
- def __init__(self, status_code, message):
+ def __init__(self, status_code: int, message):
self.status_code = status_code
self.message: str = message
self.request = httpx.Request(