{"record":{"id":"821cf0a4fcfaf01a","repo":"BerriAI/litellm","slug":"elevenlabs-api-key-is-required-set-elevenlabs-api-821cf0","errorCode":null,"errorMessage":"ElevenLabs API key is required. Set ELEVENLABS_API_KEY environment variable.","messagePattern":"ElevenLabs API key is required\\. Set ELEVENLABS_API_KEY environment variable\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/elevenlabs/text_to_speech/transformation.py","lineNumber":179,"sourceCode":"            remaining_params=params,\n        )\n\n        return mapped_voice, mapped_params\n\n    def validate_environment(\n        self,\n        headers: dict,\n        model: str,\n        api_key: str | None = None,\n        api_base: str | None = None,\n    ) -> dict:\n        \"\"\"\n        Validate Azure environment and set up authentication headers\n        \"\"\"\n        api_key = api_key or litellm.api_key or litellm.openai_key or get_secret_str(\"ELEVENLABS_API_KEY\")\n\n        if api_key is None:\n            raise ValueError(\"ElevenLabs API key is required. Set ELEVENLABS_API_KEY environment variable.\")\n\n        headers.update(\n            {\n                \"xi-api-key\": api_key,\n                \"Content-Type\": \"application/json\",\n            }\n        )\n\n        return headers\n\n    def get_error_class(self, error_message: str, status_code: int, headers: dict | Headers) -> BaseLLMException:\n        return ElevenLabsException(message=error_message, status_code=status_code, headers=headers)\n\n    def transform_text_to_speech_request(\n        self,\n        model: str,\n        input: str,\n        voice: str | None,","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/elevenlabs/text_to_speech/transformation.py#L161-L197","documentation":"Error \"ElevenLabs API key is required. Set ELEVENLABS_API_KEY environment variable.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/elevenlabs/text_to_speech/transformation.py:179 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set ELEVENLABS_API_KEY in the environment."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}