speech
Classes:
Name | Description |
---|---|
AsyncSpeech |
|
AsyncSpeechWithRawResponse |
|
AsyncSpeechWithStreamingResponse |
|
Speech |
|
SpeechWithRawResponse |
|
SpeechWithStreamingResponse |
|
AsyncSpeech
AsyncSpeech(client: AsyncOpenAI)
Methods:
Name | Description |
---|---|
create |
Generates audio from the input text. |
with_raw_response |
|
with_streaming_response |
|
create
async
create(
*,
input: str,
model: Union[str, Literal["tts-1", "tts-1-hd"]],
voice: Literal[
"alloy", "echo", "fable", "onyx", "nova", "shimmer"
],
response_format: (
Literal["mp3", "opus", "aac", "flac", "wav", "pcm"]
| NotGiven
) = NOT_GIVEN,
speed: float | NotGiven = NOT_GIVEN,
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> HttpxBinaryResponseContent
Generates audio from the input text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
str
|
The text to generate audio for. The maximum length is 4096 characters. |
required |
model
|
Union[str, Literal['tts-1', 'tts-1-hd']]
|
One of the available TTS models:
|
required |
voice
|
Literal['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']
|
The voice to use when generating the audio. Supported voices are |
required |
response_format
|
Literal['mp3', 'opus', 'aac', 'flac', 'wav', 'pcm'] | NotGiven
|
The format to audio in. Supported formats are |
NOT_GIVEN
|
speed
|
float | NotGiven
|
The speed of the generated audio. Select a value from |
NOT_GIVEN
|
extra_headers
|
Headers | None
|
Send extra headers |
None
|
extra_query
|
Query | None
|
Add additional query parameters to the request |
None
|
extra_body
|
Body | None
|
Add additional JSON properties to the request |
None
|
timeout
|
float | Timeout | None | NotGiven
|
Override the client-level default timeout for this request, in seconds |
NOT_GIVEN
|
AsyncSpeechWithRawResponse
AsyncSpeechWithRawResponse(speech: AsyncSpeech)
Attributes:
Name | Type | Description |
---|---|---|
create |
|
AsyncSpeechWithStreamingResponse
AsyncSpeechWithStreamingResponse(speech: AsyncSpeech)
Attributes:
Name | Type | Description |
---|---|---|
create |
|
Speech
Speech(client: OpenAI)
Methods:
Name | Description |
---|---|
create |
Generates audio from the input text. |
with_raw_response |
|
with_streaming_response |
|
create
create(
*,
input: str,
model: Union[str, Literal["tts-1", "tts-1-hd"]],
voice: Literal[
"alloy", "echo", "fable", "onyx", "nova", "shimmer"
],
response_format: (
Literal["mp3", "opus", "aac", "flac", "wav", "pcm"]
| NotGiven
) = NOT_GIVEN,
speed: float | NotGiven = NOT_GIVEN,
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> HttpxBinaryResponseContent
Generates audio from the input text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input
|
str
|
The text to generate audio for. The maximum length is 4096 characters. |
required |
model
|
Union[str, Literal['tts-1', 'tts-1-hd']]
|
One of the available TTS models:
|
required |
voice
|
Literal['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']
|
The voice to use when generating the audio. Supported voices are |
required |
response_format
|
Literal['mp3', 'opus', 'aac', 'flac', 'wav', 'pcm'] | NotGiven
|
The format to audio in. Supported formats are |
NOT_GIVEN
|
speed
|
float | NotGiven
|
The speed of the generated audio. Select a value from |
NOT_GIVEN
|
extra_headers
|
Headers | None
|
Send extra headers |
None
|
extra_query
|
Query | None
|
Add additional query parameters to the request |
None
|
extra_body
|
Body | None
|
Add additional JSON properties to the request |
None
|
timeout
|
float | Timeout | None | NotGiven
|
Override the client-level default timeout for this request, in seconds |
NOT_GIVEN
|