Text-to-Audio Generation API

FastRouter.ai supports text-to-audio generation using the ace-step/prompt-to-audio model on falai provider. This allows you to generate music or audio clips from simple natural language prompts — perfect for prototyping soundscapes, background music, and creative audio experiences.

Endpoints

  • For Generation:

    • POST /api/v1/chat/completions

  • For Retrieval:

    • POST /api/v1/getPromptToAudioResponse

Parameters

Parameter
Type
Description

model

string

Must be set to ace-step/prompt-to-audio

prompt

string

Natural language description of the audio/music you want to generate

duration

integer

Optional. Duration of the audio clip in seconds (e.g. 5)

Request Format

Send a natural language prompt with an optional duration parameter to generate audio.

Request Example

curl --location 'https://go.fastrouter.net/api/v1/chat/completions' \
--header 'Authorization: Bearer API-KEY' \
--header 'Content-Type: application/json' \
--data '{
    "model": "ace-step/prompt-to-audio",
    "prompt": "A lofi hiphop song with a chill vibe about a sunny day on the boardwalk.",
    "duration": 5
}'

Sample Response

You will receive a response with links to check the status and retrieve the audio when it’s ready:

{
  "chat_id": "fr_12345",
  "model": "ace-step/prompt-to-audio",
  "status": "IN_QUEUE",
  "request_id": "123abcdef",
  "response_url": "https://queue.fal.run/fal-ai/ace-step/requests/123abcdef",
  "status_url": "https://queue.fal.run/fal-ai/ace-step/requests/123abcdef/status",
  "cancel_url": "https://queue.fal.run/fal-ai/ace-step/requests/123abcdef/cancel",
  "logs": null,
  "queue_position": 0,
  "usage": {
    "chat_id": "fr_12345",
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "user_key_credits_used": 0.025,
    "credits_used": 0.025,
    "provider": "falai"
  }
}

Retrieving the Audio Output

The audio generation is asynchronous. Use the response_url returned in the initial response to fetch the final result using FastRouter’s getPromptToAudioResponse endpoint.

📌 Polling for the Audio Output

curl --location 'https://go.fastrouter.ai/api/v1/getPromptToAudioResponse' \
--header 'Authorization: Bearer API-KEY' \
--data '{
    "url": "https://queue.fal.run/fal-ai/ace-step/requests/123abcdef",
    "model": "ace-step/prompt-to-audio"
}'

When ready, the response will include a downloadable audio URL (usually in .wav or .mp3 format).

Billing & Usage

  • Credits used: user_key_credits_used in the response

  • Billed based on duration and model

  • Transparent pricing, no hidden costs

Last updated