Endpoint
POST https://api.stepfun.ai/v1/audio/generate
Request Headers
Content-Typestringrequired
Fixed asapplication/json.Authorizationstringrequired
Authentication token in the formatBearer $STEP_API_KEY.
Request Parameters
-
modelstringrequired
Model name. Currently supportsstepaudio-3-gen-preview. -
taskstringrequired
Task type. Currently onlytext_to_audiois supported: design a voice with a natural-language description and generate voices, sound effects, background music, and other sound elements. When using this task, at least one ofscriptsorinstructionis required;rolesis optional. -
rolesarrayoptional
The roles and voice descriptions used for generation. Allnameanddescriptionvalues together can be at most 500 characters. -
scriptsarrayoptional
The lines, sound-effect, or background-music descriptions to generate, at most 1,000 characters in total. A spoken line specifies its speaker viaspeakerand can use()to describe tone, style, and emotion; wrap sound-effect and background-music descriptions in[], in which casespeakercan be omitted. -
instructionstringoptional
Global natural-language guidance used to set the environment, BGM, and emotional tone. Up to 500 characters. -
response_formatstringoptional
Returned audio format. Supportswav,mp3,flac,opus, andpcm. -
speednumberoptional
Speech speed. Range: 0.5 to 2. -
volumenumberoptional
Volume. Range: 0.1 to 2.0. -
sample_rateintegeroptional
Sampling rate. Supports8000,16000,22050,24000, and48000. -
pronunciation_mapobjectoptional
Pronunciation replacement rules. -
text_normalizationstringoptional
Text normalization strategy. Supportsstandardandenhanced. -
stream_formatstringoptional
Return mode. Defaultaudio:audioreturns the generated audio directly;ssecontinuously returns Base64-encoded audio chunks via Server-Sent Events. -
return_urlbooleanoptional
Whether to return the audio URL.
The reference-voice task (
reference_to_audio), which synthesizes audio using an official or cloned voice, is not yet available; it will be added to this page once supported.Request Example
Audio generation
Limits and Compatibility
- The
instructionandrolesfields are limited to 500 characters, and thescriptsfield to 1,000 characters. stepaudio-3-gen-previewdoes not support thevoice,voice_label, ortimestampparameters.- The endpoint returns HTTP 400 when a length limit is exceeded or an unsupported parameter is passed.

