curl --request POST \
--url https://api.opper.ai/v3/audio/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>"
}
'import requests
url = "https://api.opper.ai/v3/audio/generations"
payload = { "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({model: '<string>'})
};
fetch('https://api.opper.ai/v3/audio/generations', 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": {
"cost": 123,
"duration_seconds": 123
},
"lyrics": "<string>"
}{
"id": "<string>",
"status_url": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}Generate audio
Generate audio from a text prompt with any audio generation model from GET /v3/audio/models: music (type=music) or sound effects and ambience (type=sound). By default runs synchronously and returns it inline as base64 (200). Set async: true to run it on the background worker and get a 202 with a status URL to poll instead; use it for long tracks, which can take minutes. model is required, and prompt too unless sections are sent; duration_seconds, instrumental, format (omit it for the model’s native format) and seed are normalized, and a value a model cannot honor answers 400 naming the limit. sections (a timed plan: each section’s duration_ms, prompt and styles) needs a model with the audio_sections capability, and loop one with audio_loop; a model without the capability answers 400 rather than ignoring the field. Everything in parameters is forwarded verbatim to the provider. Lyrics are returned when the provider produces them. Set store: true to also save the output to /v3/files and get a reusable file_id; nothing is stored otherwise.
curl --request POST \
--url https://api.opper.ai/v3/audio/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>"
}
'import requests
url = "https://api.opper.ai/v3/audio/generations"
payload = { "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({model: '<string>'})
};
fetch('https://api.opper.ai/v3/audio/generations', 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": {
"cost": 123,
"duration_seconds": 123
},
"lyrics": "<string>"
}{
"id": "<string>",
"status_url": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}Authorizations
API key authentication. Pass your API key as a Bearer token.
Body
Audio generation model id. List them with GET /v3/audio/models: ?type=music for songs and scores, ?type=sound for sound effects and ambience, ?capability=audio_sections or ?capability=audio_loop for models that take those fields. For example elevenlabs/music_v2_5 (music) or elevenlabs/eleven_text_to_sound_v2 (sound effects).
Run generation on the background worker and return a job to poll (202) instead of waiting inline (200). Use for full-length tracks and slow models.
Requested length in seconds (up to 600). Omit it to let the model choose. Limits differ by model, and some models have no length setting; a value a model cannot honor answers 400 naming its limit.
Output audio format: mp3, wav, opus or pcm. Omit it to get the model's native format. A format the model cannot produce answers 400 naming the ones it can.
Music only: generate without vocals.
Generate audio that repeats seamlessly, for ambience and hums. Needs a model with the audio_loop capability (GET /v3/audio/models?capability=audio_loop); other models answer 400.
Provider-specific fields, forwarded verbatim and never gated: the provider validates them. Use it for settings specific to one model, in that provider's own field names.
What to generate. For music: genre, mood, instruments, lyrics. For a sound effect: the sound itself, for example "a single hammer strike on an iron anvil". Required unless sections are set.
A timed plan for music that must fit a picture: each section's duration_ms plus its own prompt and styles, in order. The sections set the total length, so duration_seconds is not sent with them. Needs a model with the audio_sections capability (GET /v3/audio/models?capability=audio_sections); other models answer 400.
Show child attributes
Show child attributes
Seed for more repeatable output. Models without seed support answer 400.
Persist the generated audio to /v3/files and return a reusable file_id. Defaults to false; set true to store.