TTS (tts/soniox.py)

Patter · libraries/python/getpatter/tts/soniox.py · python · MIT
voice, Voice / Speech

Soniox TTS for Patter pipeline mode.

# Source: https://github.com/PatterAI/Patter | License: MIT | Copyright 2026 Patter Contributors
# Provided via justclaw.it.com; keep this notice with the code.
"""Soniox TTS for Patter pipeline mode."""

from __future__ import annotations

import os
from typing import ClassVar, Optional

from getpatter.providers.soniox_tts import SonioxTTS as _SonioxTTS

__all__ = ["TTS"]


def _resolve_api_key(api_key: str | None) -> str:
    # Shared credential with Soniox STT — same SONIOX_API_KEY env var.
    key = api_key or os.environ.get("SONIOX_API_KEY")
    if not key:
        raise ValueError(
            "Soniox TTS requires an api_key. Pass api_key='...' or "
            "set SONIOX_API_KEY in the environment."
        )
    return key


class TTS(_SonioxTTS):
    """Soniox HTTP TTS (``tts-rt-

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key