API Playground
Try the Stable Audio API from your browser. Set the parameters, hear the result, then copy the same request as code.
Sign in to generate. Generations here spend your organization's API credits, as API calls do.
Result
Your audio will play here. Generations usually take under a minute.
This request as code
generation_id=$(curl -sS -f "https://api.stability.ai/v2beta/audio/stable-audio/text-to-audio" \ -H "authorization: Bearer $STABILITY_API_KEY" \ -H "accept: audio/*" \ --form-string prompt='A lo-fi hip hop beat with dusty drums, warm Rhodes chords and a round sub bass, mellow and laid-back, tape-saturated with vinyl crackle, 90 BPM' \ --form-string model='stable-audio-3' \ --form-string duration=30 \ --form-string steps=8 \ --form-string cfg_scale=1 \ --form-string output_format='mp3' \ | jq -r '.id') while true; do status=$(curl -sS -o "./output.mp3" -w '%{http_code}' \ -H "authorization: Bearer $STABILITY_API_KEY" \ -H "accept: audio/*" \ "https://api.stability.ai/v2beta/audio/results/$generation_id") case $status in 202) sleep 5 ;; 200) break ;; *) echo "Error: $status"; exit 1 ;; esac done
The code reads your key from STABILITY_API_KEY. See the API reference for every parameter.