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 | One track in one call, answered in about 15 seconds. 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 makes one track and a Suno job two.
nmay be omitted or match that count; anything else is a400. - 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.
- 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.
Billing
- Per track. The hold is the tracks the model makes, and you pay for the tracks that arrive.
- 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-holdin place of the otherx-aile-*headers, and a failure after that is a200carrying the error body. A Suno render that is not held stops at 25 seconds with a504and is not charged. - A provider refusal you can fix (
400,404,413,422…) passes through. One about the lender'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 lender 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, Lyria on
/v1/music/generationsalso takes keyless x402. Suno needs an API key.