Generate an original music track (Lyria 3), paid with x402
Composes an original track from a description of genre, mood, instruments and tempo. lyria-3-clip: A 30-second piece: a bed for a short video, a sting, a loop. $0.06. lyria-3-pro: A full-length song with structure (intro, development, ending). $0.12. Pay via the x402 protocol (HTTP 402): call without payment to receive a 402 challenge carrying the price and networks, sign the payment with an x402-capable wallet, and retry with the payment-signature header. The challenge lists two ways to pay the same amount: USDC on Base (eip155:8453) first, then USDC on Solana mainnet (solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp); a client pays the first one it has a wallet for, and neither needs gas money in the paying wallet. No account, API key, or signup is involved, so the payment is the only credential. A payment presented again after it was redeemed is refused with a 409 (code PAYMENT_ALREADY_REDEEMED). Only the documented fields are read; a request carrying any other field is refused with a 400 before any payment moves.
The paid call answers 200 at once, with the statusUrl in the X-Status-Url header, then sends a whitespace byte every 2 seconds while it waits (JSON parsers ignore it), and ends with one complete JSON object. Read status in that body: success carries audio, the URL of the track; error means it failed, nothing was charged for it, and retryUrl tries again on the wallet balance the payment left, without paying twice; running means it outlasted the wait (45 seconds by default, Prefer: wait=N for up to 720), so poll statusUrl. Send "async": true or Prefer: respond-async for an immediate answer (200, status running) with a statusUrl. Lost the statusUrl? GET /api/x402/purchases and sign its challenge with the paying wallet (Sign-In-With-X, free) to list every purchase with its file and a fresh statusUrl. And the same request sent again from the same wallet, once the first render has finished and its file never reached you, is answered with that file (alreadyPaid, paidUsd 0) and the new payment is not taken.
Request
- Base URL: https://www.trezalabs.com
- URL: https://www.trezalabs.com/api/x402/music
- Auth: HTTP bearer
Headers
Optional. respond-async answers at once (200, status running) with a statusUrl to poll, like "async": true. wait=N sets how long the call waits, in seconds (default 45, at most 720), before it ends with status running and the statusUrl. Echoed in Preference-Applied.
Request body
Response
Payment settled and the response waited for the track. Streamed: the status and headers are sent at once (X-Status-Url carries the statusUrl), then a whitespace byte every 2 seconds, then one complete JSON object. The HTTP status is 200 whatever happened, so read status in the body.
Example response
{
"status": "success"
}Changes
No recorded changes to this operation across all 1 revision of this API.