Generate speech (TTS)
curl --request POST \
--url https://api.opper.ai/v3/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "<string>",
"model": "<string>"
}
'import requests
url = "https://api.opper.ai/v3/audio/speech"
payload = {
"input": "<string>",
"model": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: '<string>', model: '<string>'})
};
fetch('https://api.opper.ai/v3/audio/speech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"audio": {
"b64_json": "<string>",
"file_id": "<string>",
"mime_type": "<string>",
"url": "<string>"
},
"created": 123,
"id": "<string>",
"model": "<string>",
"usage": {
"characters": 123,
"cost": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}Audio
Generate speech
Convert text to spoken audio synchronously and get it back inline as base64. model and input are required; voice, format (mp3 default), and speed are normalized and validated against the model’s declared capabilities, and everything in parameters is forwarded verbatim to the provider. Output is saved to /v3/files by default and returned with a reusable file_id; set store: false to opt out.
POST
/
v3
/
audio
/
speech
Generate speech (TTS)
curl --request POST \
--url https://api.opper.ai/v3/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "<string>",
"model": "<string>"
}
'import requests
url = "https://api.opper.ai/v3/audio/speech"
payload = {
"input": "<string>",
"model": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: '<string>', model: '<string>'})
};
fetch('https://api.opper.ai/v3/audio/speech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"audio": {
"b64_json": "<string>",
"file_id": "<string>",
"mime_type": "<string>",
"url": "<string>"
},
"created": 123,
"id": "<string>",
"model": "<string>",
"usage": {
"characters": 123,
"cost": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}See the Audio guide for runnable examples and voices.
Authorizations
API key authentication. Pass your API key as a Bearer token.
Body
application/json