--- title: Stable Audio 3 Medium API emoji: 🎵 colorFrom: indigo colorTo: purple sdk: gradio sdk_version: 6.14.0 app_file: app.py pinned: false license: other short_description: Music generation API proxying stable-audio-3-medium. models: - stabilityai/stable-audio-3-medium --- # Stable Audio 3 Medium — Music API A thin, stable API wrapper around [`stabilityai/stable-audio-3`](https://huggingface.co/spaces/stabilityai/stable-audio-3), pinned to the **Medium — general audio** variant ([`stabilityai/stable-audio-3-medium`](https://huggingface.co/stabilityai/stable-audio-3-medium)). This Space uses no GPU of its own — it forwards to the upstream ZeroGPU Space and exposes a single keyword-addressable endpoint, `/generate`, so callers don't have to track upstream's positional, UI-derived signature. ## Endpoint `POST /generate` → `(wav_filepath, status_string)` | param | type | default | notes | |---|---|---|---| | `prompt` | str | — | required | | `duration` | float | 60 | seconds, 1–380 | | `steps` | float | 8 | diffusion steps | | `cfg_scale` | float | 1.0 | | | `sampler_type` | str | `pingpong` | `pingpong`, `euler`, `rk4`, `dpmpp` | | `seed` | int | 0 | 0 = random | | `negative_prompt` | str | `""` | routes via upstream `/infer_advanced` when set | | `hf_token` | str | — | **required**; your own HF token (a read token suffices) | ## Usage ```python from gradio_client import Client client = Client("sleeper371/stable-audio-3-medium-api") wav_path, status = client.predict( prompt="Warm analog house groove, deep sub bass, shuffled hats 122 BPM", duration=30, hf_token="hf_...", # your token — your quota api_name="/generate", ) print(status, wav_path) ``` ## Configuration This Space stores **no credentials**. Each caller passes their own `hf_token`, which is forwarded to upstream so ZeroGPU quota is charged to that caller — never to the Space owner. Tokens are never logged or persisted. | variable | purpose | |---|---| | `UPSTREAM_SPACE` | Override the upstream Space id. Defaults to `stabilityai/stable-audio-3`. | | `JOB_TIMEOUT` | Wall-clock budget per upstream job, including queue wait. Defaults to `900` seconds. | | `HTTPX_TIMEOUT` | HTTP timeout, which bounds the *download* of the result WAV (~67 MB at the 380s maximum). Defaults to `600` seconds. |