OpenAITTSModel (models/openai_tts.py)

openai-agents-python · src/agents/voice/models/openai_tts.py · python · MIT
voice, Voice / Speech

Module exposing: OpenAITTSModel

# Source: https://github.com/openai/openai-agents-python | License: MIT | Copyright 2025 OpenAI
# Provided via justclaw.it.com; keep this notice with the code.
from collections.abc import AsyncIterator
from typing import Literal

from openai import AsyncOpenAI, omit

from ..model import TTSModel, TTSModelSettings

DEFAULT_VOICE: Literal["ash"] = "ash"


class OpenAITTSModel(TTSModel):
    """A text-to-speech model for OpenAI."""

    def __init__(
        self,
        model: str,
        openai_client: AsyncOpenAI,
    ):
        """Create a new OpenAI text-to-speech model.

        Args:
            model: The name of the model to use.
            openai_client: The OpenAI client to use.
        """
        self.model = model
        self._client = openai_client

    @property
    def mo

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

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

Get a free API key