Music
POST /v1/music/generations takes { model, prompt } and answers
{ created, data: [{ url, format }] }, one entry per track. The model is
<provider>/<model>.
| Model | How it renders |
|---|---|
openrouter/google/lyria-3-clip-preview, openrouter/google/lyria-3-pro-preview, gemini/lyria-3-clip-preview | One track in one call, answered in about 15 seconds. url is a data:audio/mpeg;base64,… URI. |
gemini/lyria-3.5 | One song of a couple of minutes, in one call. Needs a held request (below). |
elevenlabs/eleven_text_to_sound_v2 | One sound effect, in one call, sold by length. url is a data:audio/mpeg;base64,… URI. |
elevenlabs/music_v1, elevenlabs/music_v2, elevenlabs/music_v2_5 | One song of the length you pick, 1 to 5 minutes. Needs a held request (below). url is a data:audio/mpeg;base64,… URI. |
kie/suno-v4.0, kie/suno-v3.5 | A render job, two tracks. url is the provider's own link, with the provider's expiry. |
1curl https://api.aile.sh/v1/music/generations \2-H "Authorization: Bearer $AILE_KEY" \3-H "Content-Type: application/json" \4-d '{ "model": "openrouter/google/lyria-3-clip-preview", "prompt": "calm piano at night" }'
instrumentaldefaults totrue. Sendfalsefor vocals.- Lyria and ElevenLabs make one track and a Suno job two.
nmay be omitted or match that count; anything else is a400. - ElevenLabs models are sold by length. Send
duration_seconds: 60, 120, 180, 240 or 300 on the three music models (60 when you send none), 5, 10, 15 or 30 onelevenlabs/eleven_text_to_sound_v2(5 when you send none). Any other value is a400, and so isduration_secondson any other model. - Aile keeps no copy of the audio.
On chat
/v1/chat/completions naming a Lyria model returns a chat.completion whose
message.audio.data is the MP3 in base64 (delta.audio when stream: true).
The user messages' text is the prompt, sent as written. gemini/lyria-3.5 on chat
needs stream: true, which keeps the request open while it renders; without it the
request is a 400.
- Billed per track exactly as
/v1/music/generations. The response carries no tokenusage. - An API key is required. Send the model id itself: a named route does not reach it.
- Text parts only. Tools, and an
audio.formatother thanmp3, are a400. - A price ceiling (
x-aile-max-price, or the key's price limit) is a400, because a per-track price cannot be checked against it. /v1/messagesand/v1/responsesdo not serve music models, and ElevenLabs models are served on/v1/music/generationsonly.
Billing
- Per track. The hold is the tracks the model makes, and you pay for the tracks that arrive.
- An ElevenLabs track is billed at the price of the length you pick: music $0.15 a minute, sound effects $0.12 a minute (list; a sharer may charge less). 60 seconds of music is $0.15, 300 seconds $0.75, 5 seconds of sound $0.01, 30 seconds $0.06.
- A failed job, or one that returns no audio, is a
502and is not charged. - A slow render on a keyed request is kept open: after 25 seconds the response is committed to
200and sent a space every 15 seconds until the tracks arrive, up to 8 minutes. It carriesx-aile-edge-hold,x-aile-capacity: nodelessandx-aile-blind: falsein place of the otherx-aile-*headers (the stake-funded discount's are kept, even on a failure, which is not charged), and a failure after that is a200carrying the error body. - A Suno render,
gemini/lyria-3.5and Eleven Music need a held request, so MCP'sgenerate_musictool refuses them with a400before anything is charged: callPOST /v1/music/generationsinstead. A deployment that does not hold requests refuses them the same way. - A provider refusal you can fix (
400,404,413,422…) passes through. One about the sharer's account is a502saying you were not charged. A502or504arrives as503with the real code inx-aile-status. - A key's pins and the routing headers choose the sharer here too.
x-aile-providermust match the model's prefix, and on/v1/music/generationsx-aile-max-pricedoes not apply to a per-track price. - Where the deployment enables it, the one-call Lyria models and ElevenLabs sound effects on
/v1/music/generationsalso take keyless x402. Suno,gemini/lyria-3.5and Eleven Music need an API key.