BerriAI/litellm · error · SonioxException

Failed to parse Soniox response: {exc}

Error message

Failed to parse Soniox response: {exc}

What it means

The Soniox transcription payload did not match either expected shape (transcript object or merged transcription/transcript envelope) and JSON parsing/shape detection raised; the error wraps the underlying exception for diagnosis.

Source

Thrown at litellm/llms/soniox/audio_transcription/transformation.py:180

        return AudioTranscriptionRequestData(data=body, files=None, content_type="application/json")

    def transform_audio_transcription_response(
        self,
        raw_response: Response,
        model_response: TranscriptionResponse | None = None,
    ) -> TranscriptionResponse:
        """
        Build a TranscriptionResponse from a Soniox transcript payload.

        `raw_response.json()` may be either:
          - a Soniox transcript object: `{"id": "...", "text": "...", "tokens": [...]}`
          - or a merged envelope: `{"transcription": {...}, "transcript": {...}}`
            produced by the handler so transcription metadata is also available.
        """
        try:
            payload: Final = raw_response.json()
        except Exception as exc:
            raise SonioxException(
                message=f"Failed to parse Soniox response: {exc}",
                status_code=getattr(raw_response, "status_code", 500),
                headers=getattr(raw_response, "headers", None),
            )

        return self._build_response_from_payload(payload, model_response=model_response)

    def _build_response_from_payload(
        self,
        payload: dict[str, Any],
        model_response: TranscriptionResponse | None = None,
        response_format: str | None = None,
    ) -> TranscriptionResponse:
        """Shared response-building logic (also used by the handler)."""
        transcription_meta: dict[str, Any] = {}
        transcript: dict[str, Any]

        if isinstance(payload, dict) and "transcript" in payload:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Inspect exc for the parse failure; the Soniox response shape may have changed.
  2. Verify the model and request options against the Soniox API docs.

Example fix

# log the raw Soniox response to inspect its structure.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Triggered when parsing the Soniox transcription response raises an exception.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/67c66069ae745da1. Report an issue: GitHub.