Skip to content

speech_create_params

Classes:

Name Description
SpeechCreateParams

SpeechCreateParams

Attributes:

Name Type Description
input Required[str]

The text to generate audio for. The maximum length is 4096 characters.

model Required[Union[str, Literal['tts-1', 'tts-1-hd']]]

One of the available TTS models:

response_format Literal['mp3', 'opus', 'aac', 'flac', 'wav', 'pcm']

The format to audio in.

speed float

The speed of the generated audio.

voice Required[Literal['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']]

The voice to use when generating the audio.

input instance-attribute

input: Required[str]

The text to generate audio for. The maximum length is 4096 characters.

model instance-attribute

model: Required[Union[str, Literal['tts-1', 'tts-1-hd']]]

One of the available TTS models: tts-1 or tts-1-hd

response_format instance-attribute

response_format: Literal[
    "mp3", "opus", "aac", "flac", "wav", "pcm"
]

The format to audio in.

Supported formats are mp3, opus, aac, flac, wav, and pcm.

speed instance-attribute

speed: float

The speed of the generated audio.

Select a value from 0.25 to 4.0. 1.0 is the default.

voice instance-attribute

voice: Required[
    Literal[
        "alloy", "echo", "fable", "onyx", "nova", "shimmer"
    ]
]

The voice to use when generating the audio.

Supported voices are alloy, echo, fable, onyx, nova, and shimmer. Previews of the voices are available in the Text to speech guide.