Text-to-Audio
Stable Audio generates high-quality music and sound effects up to three minutes long at 44.1kHz stereo from text descriptions. Learn how to craft effective prompts in our Prompt Guide to get the best results from your generations.
Try it out
Click Try it to test this endpoint with your API key, or try Stable Audio 2.0 for free at stableaudio.com.
How to use
Please invoke this endpoint with a POST request.
The headers of the request must include an API key in the authorization field. The body of the request must be
multipart/form-data. The accept header should be set to one of the following:
audio/*to receive the audio in the format specified by theoutput_formatparameter.application/jsonto receive the audio encoded as base64 in a JSON response.
The body of the request should include:
prompt- text to generate the audio from. Check our prompt guide for tips
Optional Parameters:
The body may optionally include:
output_format- the format of the output audioseed- the randomness seed to use for the generationsteps- the number of sampling stepsduration- the number of seconds of the generated audiocfg_scale- controls how strictly the diffusion process adheres to the prompt text (only forstable-audio-2)model- the model to use [stable-audio-2,stable-audio-2.5]
Note: for more details about these parameters please see the request schema below.
Credits
Stable Audio 2.0
By default, 20 credits per successful generation. The number of credits is determined
by the following formula: credits = 17 + 0.06 * steps.
Examples:
- 50 steps = 20 credits [default]
- 100 steps = 23 credits
Stable Audio 2.5
Requests made using the Stable Audio 2.5 model have a flat rate of 8 credits per successful result.
As always, you will not be charged for failed generations.
Authorizations
Your Stability API key, sent as a bearer token in the Authorization header.
Headers
Body
What you wish the output audio to be. A strong, descriptive prompt that clearly defines instruments, moods, styles, and genre will lead to better results.
You can make a prompt as simple or complex as you like. Simple prompts are good for clean output audio. Complex prompts are good for adding texture and depth to the output audio.
Check our prompt guide for tips.
10000Response
Generation was successful.
The bytes of the generated audio.
The finish-reason and seed will be present as headers.