Audio

Compose a music clip from a text prompt

Composes a music clip from a text prompt. Gateway extension: OpenAI has no music endpoint, so this mirrors POST /audio/sfx (JSON in, raw audio bytes out) rather than an upstream OpenAI operation. The response is the generated audio as raw binary bytes; the actual Content-Type header of the response reflects the requested response_format (e.g. audio/mpeg for mp3).

Not every provider implements music generation. Requests routed to a provider that does not support it return 400 Bad Request with an explanatory error message.

post/audio/music

Query parameters

provider'ollama' | 'ollama_cloud' | 'groq' | 'llamacpp' | 'openai' | 'cloudflare' | 'cohere' | 'anthropic' | 'deepseek' | 'elevenlabs' | 'google' | 'mistral' | 'minimax' | 'moonshot' | 'nvidia' | 'zai'

Specific provider to use (default determined by model)

Request body

modelstring required

Model ID to use for music generation (e.g. elevenlabs/music_v2_5).

promptstring required

Description of the music to compose - genre, mood, instruments, tempo.

duration_secondsnumber

Length of the clip in seconds. Omit to let the provider pick a length that fits the prompt.

instrumentalboolean

Guarantee the generated clip has no vocals.

response_format'mp3' | 'opus' | 'aac' | 'flac' | 'pcm'

The audio format of the response.

Response

The generated audio as raw binary bytes. The actual Content-Type header of the response reflects the requested response_format.

Changes

Changed in 2 of the 77 revisions of this API.11