OpenAI (TTS)

1. Overview

The industry's largest language model. Generates audio based on the input text.

Available model list:

  • tts-1

  • tts-1-hd

2. Request Description

  • Request method: POST

  • Request address: https://gateway.theturbo.ai/v1/audio/speech

3. Input Parameters

3.1 Header Parameters

Parameter Name
Type
Required
Description
Example Value

Content-Type

string

Yes

Set the request header type, which must be application/json

application/json

Authorization

string

Yes

API_KEY required for authentication. Format: Bearer $YOUR_API_KEY

Bearer $YOUR_API_KEY

3.2 Body Parameters (application/json)

Parameter Name
Type
Required
Description
Example (Default Value)

model

string

Yes

Model ID to use. See available models listed in the Overview for details, such as tts-1.

tts-1

input

string

Yes

The text used to generate audio, with a maximum length of 4,096 characters.

hello, I'm Xiaoming

voice

string

Yes

The type of voice used to generate the audio. Support alloy, ash, coral, echo, fable, onyx, nova, sage, and shimmer. (Official Docs)

alloy

response_format

string

No

The output format of the audio. Support mp3, opus, aac, flac, wav, pcm.

mp3

speed

number

No

The speech rate for generating the audio. The optional range is from 0.25 to 4.0. 1.0

4. Request Example

POST /v1/audio/speech
Content-Type: application/json
Authorization: Bearer $YOUR_API_KEY

{
	"model": "tts-1",
	"input": "Hello, I'm Xiaoming",
	"voice": "alloy"
}

5. Response Example

HTTP/1.1 200 OK
Content-Type: audio/mpeg

Audio binary file

Last updated