{"record":{"id":"0f43a269b38414d3","repo":"BerriAI/litellm","slug":"gemini-api-key-or-google-api-key-is-required-for-v","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/gemini/videos/transformation.py","lineNumber":205,"sourceCode":"    def validate_environment(\n        self,\n        headers: dict,\n        model: str,\n        api_key: str | None = None,\n        litellm_params: GenericLiteLLMParams | None = None,\n    ) -> dict:\n        \"\"\"\n        Validate environment and add Gemini API key to headers.\n        Gemini uses x-goog-api-key header for authentication.\n        \"\"\"\n        # Use api_key from litellm_params if available, otherwise fall back to other sources\n        if litellm_params and litellm_params.api_key:\n            api_key = api_key or litellm_params.api_key\n\n        api_key = api_key or litellm.api_key or get_secret_str(\"GOOGLE_API_KEY\") or get_secret_str(\"GEMINI_API_KEY\")\n\n        if not api_key:\n            raise ValueError(\n                \"GEMINI_API_KEY or GOOGLE_API_KEY is required for Veo video generation. \"\n                \"Set it via environment variable or pass it as api_key parameter.\"\n            )\n\n        headers.update(\n            {\n                \"x-goog-api-key\": api_key,\n                \"Content-Type\": \"application/json\",\n            }\n        )\n        return headers\n\n    def get_complete_url(\n        self,\n        model: str,\n        api_base: str | None,\n        litellm_params: dict,\n    ) -> str:","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/gemini/videos/transformation.py#L187-L223","documentation":"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.","triggerScenarios":"Thrown at litellm/llms/gemini/videos/transformation.py:205 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set GEMINI_API_KEY or GOOGLE_API_KEY, or pass api_key, for Veo video generation."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}