Stable Audio
An advanced audio generation model designed to create high-quality audio tracks from textual prompts.
How to Make a Call
API Schemas
The prompt to generate audio.
The start point of the audio clip to generate.
The duration of the audio clip to generate.
30The number of steps to denoise the audio.
100The ID of the generated audio.
60ac7c34-3224-4b14-8e7d-0aa0db708325The current status of the generation task.
completedPossible values: curl -L \
--request POST \
--url 'https://api.aimlapi.com/v2/generate/audio' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"model": "stable-audio",
"prompt": "Lo-fi pop hip-hop ambient music, slow intro: 10 s, then faster and with loud bass: 10 s",
"seconds_total": 20
}'{
"id": "60ac7c34-3224-4b14-8e7d-0aa0db708325",
"status": "completed",
"audio_file": {
"url": "https://cdn.aimlapi.com/generations/hippopotamus/1757963033314-8ca7729d-b78c-4d4c-9ef9-89b2fb3d07e8.mp3"
},
"error": {
"name": "text",
"message": "text"
},
"meta": {
"usage": {
"credits_used": 120000
}
}
}Retrieve the generated music sample from the server
After sending a request for music generation, this task is added to the queue. This endpoint lets you check the status of a audio generation task using its id, obtained from the endpoint described above.
If the video generation task status is complete, the response will include the final result — with the generated audio URL and additional metadata.
Bearer key
<REPLACE_WITH_YOUR_GENERATION_ID>The ID of the generated audio.
60ac7c34-3224-4b14-8e7d-0aa0db708325The current status of the generation task.
completedPossible values: curl -L \
--request GET \
--url 'https://api.aimlapi.com/v2/generate/audio?generation_id=<REPLACE_WITH_YOUR_GENERATION_ID>' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>'{
"id": "60ac7c34-3224-4b14-8e7d-0aa0db708325",
"status": "completed",
"audio_file": {
"url": "https://cdn.aimlapi.com/eagle/files/lion/5N4F_QWb5K8rDSHfpUN0S_output.wav"
},
"error": {
"name": "text",
"message": "text"
},
"meta": {
"usage": {
"credits_used": 120000
}
}
}Full Example: Generating and Retrieving the Audio From the Server
The code below creates a audio generation task, then automatically polls the server every 10 seconds until it finally receives the video URL.
Listen to the track we generated:
Last updated
Was this helpful?