Stability AI
Stable Audio 3 Medium
stable-audio-3-medium/text-to-audio
Stable Audio 3 Medium is an audio generation model from Stability AI, offering three tasks on HiAPI: generating audio from scratch based on a text description, with a default of 30 seconds and a maximum of 380 seconds; redoing a specified time segment within existing audio; and extending new content at the beginning or end of audio. Output supports 7 formats including MP3, WAV, and FLAC, and supports fixed random seeds for reproducing results, making it suitable for scenarios such as short video soundtracks, game and ambient audio, podcast packaging, and sound effect drafts.
Try stable-audio-3-medium/text-to-audio
Input
Showcases
View all showcasesOutput
Pricing
stable-audio-3-medium/text-to-audio $0.0538 per audio
Overview
Stable Audio 3 Medium's text-to-audio capability generates complete audio from scratch based on a text description, and lets you specify instruments, rhythm, ambient sounds and sense of spatial distance. A single request can be up to 380 seconds (about 6 minutes 20 seconds), defaults to 30 seconds, and can output MP3, WAV, FLAC and other formats. It suits developers and content teams that need to produce soundtrack drafts, ambient audio and sound-effect assets in bulk.
Key Highlights
- Up to 380 seconds per request — duration defaults to 30 seconds and can be set from 1 to 380 seconds, so a complete soundtrack needs no segmented stitching.
- 7 output containers available — output_format supports mp3, wav, flac, ogg, opus, m4a and aac, defaulting to mp3; wav and flac are lossless and can be used directly for post-production or archiving.
- Ready results with the default 8 steps — num_inference_steps defaults to 8; the post-trained (distilled) checkpoint already performs well at the default step count, and raising it further yields limited gains.
- Automatic prompt expansion — when enable_prompt_expansion is on, an LLM expands a single-sentence description into a more detailed prompt, reducing reliance on prompt-writing skill.
Capabilities
- Generate audio from text descriptions: prompt is the only required parameter; state the desired instruments, melodic direction, mood and sense of space, and the model generates the full audio accordingly. Prompts can be up to 5000 characters.
- Controllable duration and format: duration sets the length of the result in seconds, defaulting to 30 with a range of 1 to 380; output_format selects the container format; for compressed formats, bitrate sets the bit rate, defaulting to 192k and accepting 320k, with no effect on wav or flac.
- Negative prompts and guidance strength: negative_prompt describes sonic characteristics to avoid and defaults to an empty string; guidance_scale defaults to 1, and higher values follow the prompt more strictly, taking effect only on the base (non-distilled) checkpoint.
- Reproducible results: pass a seed to reproduce the same result; if omitted, a random seed is used each time. When comparing parameters or prompts, fixing the seed makes differences easier to hear.
- Adjustable sampling steps: num_inference_steps defaults to 8 and can be set from 1 to 100; start with the default to get a draft, then compare finer detail at higher step counts as needed.
Use Cases
- Soundtracks for short videos and podcasts — generate roughly 30 seconds of background music from a one-line style description and lay it directly under footage or voiceover.
- Ambient audio for games and apps — describe the scene, weather and sense of space to generate a first version of a loopable ambient track.
- Sound-effect and foley drafts — when a specific texture is needed (a close-miked wooden knock, distant rain), produce a draft first and then decide whether to record in a studio.
- Prepare multiple duration versions at once — change only duration on the same prompt to produce 8-second, 30-second, 120-second and other versions suited to different placements.
Limitations and Model-Selection Advice
prompt is required and can be up to 5000 characters. duration ranges from 1 to 380 seconds; beyond that, trim or generate in segments. bitrate applies only to compressed formats such as mp3, aac and opus, and is ignored for wav and flac. guidance_scale takes effect only on the base checkpoint; leaving it at the default of 1 is sufficient. This capability generates from text: to change only one section of an existing recording, use "Local Inpainting"; to extend an existing recording, use "Audio Continuation". The more specific the prompt (instruments, playing technique, recording distance, presence of ambient sound), the more controllable the result.
What's new
View changelog →- New model stable-audio-3-medium text-to-audio model now available
- New model stable-audio-3-medium/audio-inpainting is now available
- New model New model available: stable-audio-3-medium/audio-outpainting
Frequently asked questions
View all FAQs →-
How long an audio clip can be generated at once?
duration controls the length, ranging from 1 to 380 seconds (about 6 minutes 20 seconds), with a default of 30 seconds. For longer works, it is recommended to generate them segment by segment, then use audio continuation to connect the segments.
-
What is the maximum length of a prompt?
The prompt is required, and the platform's input limit per request is 5000 characters. Clearly specifying the instruments, rhythm, mood, and use case is more likely to produce the expected result than piling on adjectives; when the prompt is very short, you can enable enable_prompt_expansion to let the model expand it first.
-
How should prompts be organized when generating music?
Write in the order of "instruments and timbre, rhythm and groove, emotion and dynamics, scene and texture", and state whether vocals are wanted. Put unwanted elements in negative_prompt, for example noise, distortion, abrupt silence.
-
How can I repair only a segment of the audio?
Use mask_start_seconds and mask_end_seconds to specify the start and end times in seconds. The end time must be later than the start time and cannot exceed the duration of the source audio. For example, in an 8-second audio clip, setting the start point to 2 and the end point to 4 will repair seconds 2 through 4.
Create a generation task
https://api.hiapi.ai/v1/tasks Headers
AuthorizationstringRequiredAccount API key. Required on every request. Example: Bearer YOUR_HIAPI_API_KEY. Get your API key
Content-TypestringOptionalThe request body is always parsed as JSON; when sent, only application/json (optionally with charset) is accepted — any other value returns 415. Example: application/json.
Idempotency-KeystringOptionalIdempotency key, up to 255 bytes. Retries with the same key from the same account create the task only once; replays return the original taskId.
On network timeouts or client retries, the same key creates the task only once — no double charges (scope: the API key's account). Use a business-unique identifier as the key (e.g. "order-42"); replays return the original taskId, and keys expire 24 hours after the first request. See the Unified Async API overview for the full scenario matrix.
Body
modelstringRequiredCurrent fixed value: stable-audio-3-medium/text-to-audio
routestringOptionalCurrent fixed value: default
inputobjectRequired
Business parameters for stable-audio-3-medium/text-to-audio and route default — see the parameter table below.
seedintegerOptionalRandom seed for reproducing results, as an integer; if omitted, a random seed is used.
promptstringRequiredminLength 1maxLength 5000pattern \SText description of the audio to generate, the main input driving the generated content.
bitratestringOptionalDefault: "192k"Audio bitrate for compressed output formats (such as mp3, aac, opus), as a string like "192k" or "320k", default 192k; has no effect on lossless formats (wav, flac).
durationnumberOptionalDefault: 30min 1max 380Duration of the audio to generate, in seconds. Default 30 seconds, range 1 to 380 seconds.
output_formatstringOptionalDefault: "mp3"Container format of the generated audio output, default mp3.
mp3wavflacoggopusm4aaacguidance_scalenumberOptionalDefault: 1min 0max 25Classifier-free guidance coefficient, as a numeric value; higher values follow the prompt more strictly, default 1; only takes effect on base (non-distilled) checkpoints.
negative_promptstringOptionalDefault: ""Text describing sound characteristics to avoid, default empty string.
num_inference_stepsintegerOptionalDefault: 8min 1max 100Number of sampling steps, as an integer, default 8; post-trained (distilled) checkpoints already perform well at the default 8 steps, and further increases yield limited gains.
enable_prompt_expansionbooleanOptionalDefault: falseWhether to use an LLM to expand the prompt for more detailed, higher-quality results, as a boolean, default false.
callbackobjectOptional
Terminal-state notification config. When omitted, no callback is delivered — poll the task yourself. See the callback note below.
Provide callback.url when creating a task and HiAPI POSTs to your service once the task reaches a terminal state — no polling needed. The callback payload mirrors the task detail structure; signature verification, delivery retries and idempotency are documented on the Unified Async API overview page.
urlstringRequiredRequired when callback is present. A POST is sent to this URL once the task reaches a terminal state; must be a valid http(s) URL.
whenstringOptionalDefault: "final"Only final is supported today — notified on both success and fail.
finalstoragestringOptionalDefault: "temp"Artifact storage tier: temp (default, retained about 7 days) or persistent (long-term, billed by size). Insufficient balance or exceeding the storage cap silently downgrades to temp; the effective tier is shown in the task detail response.
temppersistentRequest examples
# Submit an async task; returns a taskId immediately (no waiting for generation)
curl -X POST "https://api.hiapi.ai/v1/tasks" \
-H "Authorization: Bearer $HIAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "stable-audio-3-medium/text-to-audio",
"input": {
"prompt": "…",
"bitrate": "192k",
"duration": 30,
"output_format": "mp3",
"guidance_scale": 1,
"negative_prompt": "",
"num_inference_steps": 8,
"enable_prompt_expansion": false
}
}' const res = await fetch("https://api.hiapi.ai/v1/tasks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HIAPI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "stable-audio-3-medium/text-to-audio",
input: {
"prompt": "…",
"bitrate": "192k",
"duration": 30,
"output_format": "mp3",
"guidance_scale": 1,
"negative_prompt": "",
"num_inference_steps": 8,
"enable_prompt_expansion": false
}
}),
});
const task = await res.json();
// { code: 200, message: "success", data: { taskId } } import os, requests
res = requests.post(
"https://api.hiapi.ai/v1/tasks",
headers={"Authorization": f"Bearer {os.environ['HIAPI_API_KEY']}"},
json={
"model": "stable-audio-3-medium/text-to-audio",
"input": {
"prompt": "…",
"bitrate": "192k",
"duration": 30,
"output_format": "mp3",
"guidance_scale": 1,
"negative_prompt": "",
"num_inference_steps": 8,
"enable_prompt_expansion": False
}
},
)
print(res.json()) # { code, message, data: { taskId } } 200 OK
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR"
}
} 400 Bad Request
{
"code": 400,
"message": "invalid request",
"data": null,
"error_code": "INVALID_REQUEST"
} Get task detail
https://api.hiapi.ai/v1/tasks/:id Response fields
taskIdstringRequiredTask ID, always prefixed with tk-hiapi-.
modelstringRequiredResolved full model name. Tasks submitted with the route parameter return base@route (e.g. gpt-image-2/text-to-image@ext); otherwise identical to the name passed at creation.
routestringOptionalPresent only when the task was submitted with an explicit route parameter; echoes the submitted value.
statusstringRequiredTask status.
queued Queued, not started yet.
handling Being processed.
archiving Processing finished, artifacts being prepared.
success Terminal: completed, artifacts available (output returned).
fail Terminal: failed (error returned).
After submission, check status: success and fail are terminal, everything else is non-terminal. Poll every 1–3 seconds until terminal. On success, download artifacts from output[].url and transfer them before expireAt; pass storage: "persistent" at creation time when long-term retention is needed.
creatednumberRequiredTask creation time (Unix seconds).
completednumberRequiredUnix seconds when the task reached a terminal state; fixed to 0 while not terminal.
outputarrayOptional
Present only when status == success. Artifact list — always an array; a single task may return multiple types at once (e.g. video + first_frame).
Array [ object ]
Array items
urlstringRequiredArtifact URL, directly downloadable.
typestringRequiredCurrent possible values: video, image, audio, first_frame, last_frame, thumbnail; more may be added later.
expireAtnumberRequiredUnix seconds until which the artifact remains accessible; download or transfer before it expires.
errorobjectOptional
Present only when status == fail.
codestringRequiredBusiness error code.
messagestringRequiredError description.
Response examples
Success
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR",
"model": "happyhorse-1-0",
"status": "success",
"created": 1777282033,
"completed": 1777282099,
"output": [
{
"url": "https://cdn.hiapi.ai/tasks/.../video.mp4",
"type": "video",
"expireAt": 1777886899
}
]
}
} Processing (non-terminal)
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "archiving",
"created": 1777282033,
"completed": 0
}
} Failed
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "fail",
"created": 1777282033,
"completed": 1777282099,
"error": {
"code": "TASK_FAILED",
"message": "task failed"
}
}
} Articles
View all articles →-
Tutorial
Stable Audio 3 Medium Text-to-Audio in Practice: 5 High-Value Business Scenarios and Integration Essentials
From cost accounting to implementation, how development teams can integrate text-to-audio into real business
-
Comparison
Stable Audio 3 Medium Text-to-Audio Comparison and Model Selection Guide
Based on pricing, output form, and integration method, determine whether it suits your audio generation pipeline
-
Guide
Stable Audio 3 Medium Text-to-Audio Getting Started Guide: Capability Boundaries, Pricing, and Integration Practices
Related Models
View all models →Same Type
-
ElevenLabs Sound Effects ElevenLabs $0.0029 /second -
Qwen Audio 3.0 TTS Alibaba $0.030 /1,000 characters -
Mirelo SFX 2.0 Mirelo AI $0.021 /second -
MiniMax Music 2.6 MiniMax $0.210 /song -
Lyria 3.5 Google $0.090 /song -
ElevenLabs ElevenLabs $0.125 /1,000 characters -
MiniMax Music 3 MiniMax $0.0026 /second -
Mureka 9.5 Mureka $0.322 per request -
MiniMax Music 1.5 MiniMax $0.070 /song -
Lyria 3 Pro Google $0.140 /song



