BerriAI/litellm · error

Error transforming ElevenLabs response

Error message

Error transforming ElevenLabs response: {e}
Response: {raw_response.text}

What it means

Raised when transforming the ElevenLabs speech-to-text response fails (unexpected JSON shape, missing words/language fields); the exception and the raw HTTP body are logged in the message to expose the actual payload.

Solutions

  1. Inspect the raw response in the error; ElevenLabs returned an unexpected payload.
  2. Verify the ElevenLabs model and request options, and upgrade litellm if the schema changed.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/llms/elevenlabs/audio_transcription/transformation.py:149 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/db85eeb66471dfbc. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/elevenlabs/audio_transcription/transformation.py:149

                response["words"] = []
                for word_data in response_json["words"]:
                    # Only include actual words, skip spacing and audio events
                    if word_data.get("type") == "word":
                        response["words"].append(
                            {
                                "word": word_data.get("text", ""),
                                "start": word_data.get("start", 0),
                                "end": word_data.get("end", 0),
                            }
                        )

            # Store full response in hidden params
            response._hidden_params = response_json

            return response

        except Exception as e:
            raise ValueError(f"Error transforming ElevenLabs response: {e}\nResponse: {raw_response.text}")

    def get_complete_url(
        self,
        api_base: str | None,
        api_key: str | None,
        model: str,
        optional_params: dict,
        litellm_params: dict,
        stream: bool | None = None,
    ) -> str:
        if api_base is None:
            api_base = get_secret_str("ELEVENLABS_API_BASE") or "https://api.elevenlabs.io"
        api_base = api_base.rstrip("/")  # Remove trailing slash if present

        # ElevenLabs speech-to-text endpoint
        url: Final = f"{api_base}/v1/speech-to-text"

        return url

View on GitHub (pinned to 77b7c6c40c)