API Playground

Try the Stable Audio API from your browser. Set the parameters, hear the result, then copy the same request as code.

Generate music or sound from a text prompt. POST /v2beta/audio/stable-audio/text-to-audio

Prompt

Length of the generated audio.

Advanced settings

Sampling steps. More takes longer and can add detail.

How closely the audio follows the prompt.

0 picks a random seed. Reuse a seed to repeat a result.

Output format
Sign in to generate

Uses 8 credits ($0.08) from your account when it succeeds.

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.