---
title: "Compose a music clip from a text prompt"
method: POST
path: "/audio/music"
tags: ["Audio"]
---

# Compose a music clip from a text prompt

`POST /audio/music`

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.

## Query parameters

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

## Request body

- CreateMusicRequest — Request body for composing a music clip from a text prompt.
  - `model` string, required — Model ID to use for music generation (e.g. `elevenlabs/music_v2_5`).
  - `prompt` string, required — Description of the music to compose - genre, mood, instruments, tempo.
  - `duration_seconds` number — Length of the clip in seconds. Omit to let the provider pick a length that fits the prompt.
  - `instrumental` boolean — Guarantee the generated clip has no vocals.
  - `response_format` 'mp3' | 'opus' | 'aac' | 'flac' | 'pcm' — The audio format of the response.

## Response `200`

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

## Other responses

- `400` — The selected provider does not implement music generation. The gateway returns this when a request is routed to a provider without text-to-music support.
- `401` — Unauthorized
- `500` — Internal server error

## Changes

- **2026-09-22** `8ba1cde82f00` — 1 breaking
  - removed the enum value `wav` of the request property `response_format`
- **2026-09-22** `0c404edb789f` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/inference-gateway/apis/inference-gateway-api/changes/audio/music/post.md)

---

[API](https://skmtc.dev/inference-gateway/apis/inference-gateway-api.md) · [All operations](https://skmtc.dev/inference-gateway/apis/inference-gateway-api/llms.txt) · [OpenAPI document](https://skmtc.dev/inference-gateway/apis/inference-gateway-api/revisions/0719fad9dbb1?raw)
