Text-to-Speech: Generate audio from text
POST
/v1/audio/speechPOST
/v1/audio/speechYour instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.
Request Body
| Property | Type | Required | Description |
|---|---|---|---|
model | string | No | |
input | string | No | |
voice | string | No | |
responseFormat | string | No | |
speed | number | No | |
metadata | object | No |
Responses
200 Generated audio file
| Property | Type | Description |
|---|---|---|
audio | string | |
format | string | |
contentType | string | |
durationSeconds | number | |
inputCharacters | integer |
default An unexpected error response.
| Property | Type | Description |
|---|---|---|
code | integer | |
message | string | |
details | object[] |
Request
curl -X POST "http://localhost:8089/v1/audio/speech" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"string","input":"string","voice":"string","responseFormat":"string","speed":0}'const response = await fetch("http://localhost:8089/v1/audio/speech", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "string",
"input": "string",
"voice": "string",
"responseFormat": "string",
"speed": 0
}),
});
const data = await response.json();import requests
response = requests.post(
"http://localhost:8089/v1/audio/speech",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "string",
"input": "string",
"voice": "string",
"responseFormat": "string",
"speed": 0
},
)
data = response.json()Response
{
"audio": "string",
"format": "string",
"contentType": "string",
"durationSeconds": 0,
"inputCharacters": 0
}{
"code": 0,
"message": "string",
"details": [
{
"@type": "string"
}
]
}
