BerriAI/litellm · error · ValueError
LiteLLM's `gemini/` route does not support image generation
Error message
LiteLLM's `gemini/` route does not support image generation yet. Let us know if you need this feature by opening an issue at https://github.com/BerriAI/litellm/issues
What it means
Error "LiteLLM's `gemini/` route does not support image generation yet. Let us know if you need this feature by opening an issue at https://github.com/BerriAI/litellm/issues" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/vertex_ai/common_utils.py:485
if mode == "chat":
endpoint = "generateContent"
if stream is True:
endpoint = "streamGenerateContent"
url = f"https://generativelanguage.googleapis.com/{api_version}/{_gemini_model_name}:{endpoint}?alt=sse"
else:
url = f"https://generativelanguage.googleapis.com/{api_version}/{_gemini_model_name}:{endpoint}"
elif mode == "embedding":
endpoint = "embedContent"
url = f"https://generativelanguage.googleapis.com/v1beta/{_gemini_model_name}:{endpoint}"
elif mode == "batch_embedding":
endpoint = "batchEmbedContents"
url = f"https://generativelanguage.googleapis.com/v1beta/{_gemini_model_name}:{endpoint}"
elif mode == "count_tokens":
endpoint = "countTokens"
url = f"https://generativelanguage.googleapis.com/v1beta/{_gemini_model_name}:{endpoint}"
elif mode == "image_generation":
raise ValueError(
"LiteLLM's `gemini/` route does not support image generation yet. Let us know if you need this feature by opening an issue at https://github.com/BerriAI/litellm/issues"
)
else:
raise ValueError(f"Unsupported mode: {mode}")
return url, endpoint
def _check_text_in_content(parts: list[PartType]) -> bool:
"""
check that user_content has 'text' parameter.
- Known Vertex Error: Unable to submit request because it must have a text parameter.
- 'text' param needs to be present (empty strings are valid)
- Relevant Issue: https://github.com/BerriAI/litellm/issues/5515
"""
has_text_param = False
for part in parts:
if "text" in part and part.get("text") is not None:View on GitHub (pinned to 77b7c6c40c)
Solutions
- Use the vertex_ai/ route (e.g. vertex_ai/imagen-3.0-generate-001) for image generation instead of gemini/.
- Or request support via the linked GitHub issue.
Example fix
litellm.image_generation(model="vertex_ai/imagen-3.0-generate-001", prompt=...)
Defensive patterns
Strategy: fallback
When it happens
Trigger: Triggered when requesting image generation through LiteLLM's gemini/ route, which is not yet supported.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/23f1b559dfe4a678.
Report an issue: GitHub.