Skip to main content
Generate a wide range of sound elements—voices, sound effects, ambient sound, and background music—in a unified way from text descriptions.

Endpoint

POST https://api.stepfun.ai/v1/audio/generate

Request Headers

  • Content-Type string required
    Fixed as application/json.
  • Authorization string required
    Authentication token in the format Bearer $STEP_API_KEY.

Request Parameters

  • model string required
    Model name. Currently supports stepaudio-3-gen-preview.
  • task string required
    Task type. Currently only text_to_audio is 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 of scripts or instruction is required; roles is optional.
  • roles array optional
    The roles and voice descriptions used for generation. All name and description values together can be at most 500 characters.
  • scripts array optional
    The lines, sound-effect, or background-music descriptions to generate, at most 1,000 characters in total. A spoken line specifies its speaker via speaker and can use () to describe tone, style, and emotion; wrap sound-effect and background-music descriptions in [], in which case speaker can be omitted.
  • instruction string optional
    Global natural-language guidance used to set the environment, BGM, and emotional tone. Up to 500 characters.
  • response_format string optional
    Returned audio format. Supports wav, mp3, flac, opus, and pcm.
  • speed number optional
    Speech speed. Range: 0.5 to 2.
  • volume number optional
    Volume. Range: 0.1 to 2.0.
  • sample_rate integer optional
    Sampling rate. Supports 8000, 16000, 22050, 24000, and 48000.
  • pronunciation_map object optional
    Pronunciation replacement rules.
  • text_normalization string optional
    Text normalization strategy. Supports standard and enhanced.
  • stream_format string optional
    Return mode. Default audio: audio returns the generated audio directly; sse continuously returns Base64-encoded audio chunks via Server-Sent Events.
  • return_url boolean optional
    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 instruction and roles fields are limited to 500 characters, and the scripts field to 1,000 characters.
  • stepaudio-3-gen-preview does not support the voice, voice_label, or timestamp parameters.
  • The endpoint returns HTTP 400 when a length limit is exceeded or an unsupported parameter is passed.