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]

(gemini)Handle HTTP 201 status code in Vertex AI response

sven8d053930e994
diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
index 294939a3c57..9ac1b1ffc49 100644
--- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
+++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
@@ -846,7 +846,7 @@ async def make_call(
message=VertexGeminiConfig().translate_exception_str(exception_string),
headers=e.response.headers,
)
- if response.status_code != 200:
+ if response.status_code != 200 and response.status_code != 201:
raise VertexAIError(
status_code=response.status_code,
message=response.text,
@@ -884,7 +884,7 @@ def make_sync_call(
response = client.post(api_base, headers=headers, data=data, stream=True)
- if response.status_code != 200:
+ if response.status_code != 200 and response.status_code != 201:
raise VertexAIError(
status_code=response.status_code,
message=str(response.read()),