Music

POST /v1/music/generations takes { model, prompt } and answers { created, data: [{ url, format }] }, one entry per track. The model is <provider>/<model>.

ModelHow it renders
openrouter/google/lyria-3-clip-preview, openrouter/google/lyria-3-pro-previewOne track in one call, answered in about 15 seconds. url is a data:audio/mpeg;base64,… URI.
kie/suno-v4.0, kie/suno-v3.5A render job, two tracks. url is the provider's own link, with the provider's expiry.
cURLcurl
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" }'
  • instrumental defaults to true. Send false for vocals.
  • Lyria makes one track and a Suno job two. n may be omitted or match that count; anything else is a 400.
  • 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 token usage.
  • An API key is required. Send the model id itself: a named route does not reach it.
  • Text parts only. Tools, and an audio.format other than mp3, are a 400.
  • A price ceiling (x-aile-max-price, or the key's price limit) is a 400, because a per-track price cannot be checked against it.
  • /v1/messages and /v1/responses do 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 502 and is not charged.
  • A slow render on a keyed request is kept open: after 25 seconds the response is committed to 200 and sent a space every 15 seconds until the tracks arrive, up to 8 minutes. It carries x-aile-edge-hold in place of the other x-aile-* headers, and a failure after that is a 200 carrying the error body. A Suno render that is not held stops at 25 seconds with a 504 and is not charged.
  • A provider refusal you can fix (400, 404, 413, 422 …) passes through. One about the lender's account is a 502 saying you were not charged. A 502 or 504 arrives as 503 with the real code in x-aile-status.
  • A key's pins and the routing headers choose the lender here too. x-aile-provider must match the model's prefix, and on /v1/music/generations x-aile-max-price does not apply to a per-track price.
  • Where the deployment enables it, Lyria on /v1/music/generations also takes keyless x402. Suno needs an API key.