BerriAI/litellm · error · ValueError
GEMINI_API_KEY or GOOGLE_API_KEY is required for Veo video…
Error message
GEMINI_API_KEY or GOOGLE_API_KEY is required for Veo video generation. Set it via environment variable or pass it as api_key parameter.
What it means
Error "GEMINI_API_KEY or GOOGLE_API_KEY is required for Veo video generation. Set it via environment variable or pass it as api_key parameter." thrown in BerriAI/litellm.
Solutions
- Set GEMINI_API_KEY or GOOGLE_API_KEY, or pass api_key, for Veo video generation.
When it happens
Trigger: Thrown at litellm/llms/gemini/videos/transformation.py:205 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/0f43a269b38414d3.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/gemini/videos/transformation.py:205
def validate_environment(
self,
headers: dict,
model: str,
api_key: str | None = None,
litellm_params: GenericLiteLLMParams | None = None,
) -> dict:
"""
Validate environment and add Gemini API key to headers.
Gemini uses x-goog-api-key header for authentication.
"""
# Use api_key from litellm_params if available, otherwise fall back to other sources
if litellm_params and litellm_params.api_key:
api_key = api_key or litellm_params.api_key
api_key = api_key or litellm.api_key or get_secret_str("GOOGLE_API_KEY") or get_secret_str("GEMINI_API_KEY")
if not api_key:
raise ValueError(
"GEMINI_API_KEY or GOOGLE_API_KEY is required for Veo video generation. "
"Set it via environment variable or pass it as api_key parameter."
)
headers.update(
{
"x-goog-api-key": api_key,
"Content-Type": "application/json",
}
)
return headers
def get_complete_url(
self,
model: str,
api_base: str | None,
litellm_params: dict,
) -> str:View on GitHub (pinned to 77b7c6c40c)