Convert AIFF to MP3
To convert AIFF to MP3, send one POST to /v1/audio-convert with the AIFF source and "to": "mp3" in the body. "mp3" is the schema default of "to", so the field may also be left out. Each call costs $0.003 in USDC on Base via x402, with no account and no API key. The source file can be up to 100 MB and 60 min (3,600 s) long.
- Endpoint
POST /v1/audio-convert- Price
- $0.003 per call
- Service
- audio-convert
01Limits
| Limit | Value |
|---|---|
| Largest source file | 100 MB (104,857,600 bytes) |
| Longest input | 60 min (3,600 s) |
| Timeout | 94 s |
| Source formats | AIFF, AVI, FLAC, MKV, MP3, MP4, Ogg, WAV |
| Output formats | AAC, FLAC, MP3, Opus, WAV |
02Example
A real AIFF to MP3 run of audio-convert.
POST /v1/audio-convert
content-type: application/json
payment-signature: <base64 x402 payload>
{
"url": "https://grist.tools/samples/av/pair-tone.aiff",
"to": "mp3"
}200 OK
payment-response: <base64 settlement receipt>
{
"source_url": "https://grist.tools/samples/av/pair-tone.aiff",
"bytes": 48054,
"source_container": "aiff",
"format": "mp3",
"bitrate_kbps": null,
"sample_rate": null,
"audio_bytes": 3188,
"audio_base64": "SUQzBAAAAAAACgAAAAAAAAAAAAD/4xjEAApAAx75QRACiHZUlw94AlAQBAEwfB8H..."
}Source file: av/pair-tone.aiff, 46.9 KB (48,054 bytes). 3 s mono 8 kHz 16-bit PCM AIFF file written directly by the generator: three 0.5 s 500 Hz triangle beeps at rising level, each followed by 0.5 s of silence. The recorded run returned 3.1 KB (3,188 bytes) of MP3, 7% of the source size, with the source read as the aiff container. Decoded, the MP3 in audio_base64 opens with 49 44 33 04 00 00 00 00 00 0A 00 00. Recorded with ffmpeg 8.1.2.
In the sample itself, the FORM container is of type AIFF; the COMM chunk declares 1 channel, 24,000 sample frames of 16 bits and a rate of 8,000 Hz stored as an 80-bit extended float, 3 s; the SSND chunk holds 48,008 bytes, big-endian samples behind an 8-byte offset and block size header. In the returned MP3: it opens with an ID3v2.4 tag with 10 bytes of body, then an MPEG 2.5 Layer III frame header at byte 20: 8 kbps, 8,000 Hz, mono.
03Format notes
AIFF as a source
AIFF files start with the IFF marker FORM, and Grist also requires the form type at byte eight to read AIFF or AIFC, the variant that allows compressed audio. Classic AIFF stores its PCM samples big-endian, the opposite byte order to WAV. The format is audio only, so video-thumbnail and subtitle-extract turn it away as a container without a picture or caption stream, and audio-convert is its single reader. That service measures the first audio stream's duration, maps only that stream, and strips metadata and chapters before encoding. AIFF is absent from audio-convert's destination enum, so it can be read here but not written. Converting to WAV rewrites the samples as little-endian PCM through the pinned pcm_s16le codec, which changes byte order without altering the sampled values of a sixteen-bit source.
MP3 as a target
MP3 is the default value of audio-convert's to field, encoded with the pinned libmp3lame codec. The mp3 muxer needs no seeking, so output streams straight to a pipe instead of a temporary file. bitrate_kbps applies to this lossy destination; when it is omitted, no audio bitrate argument is passed, the encoder's own default applies, and the response reports the bitrate as null. An optional sample_rate selects from the closed set, otherwise ffmpeg normally follows the source. Only the first audio stream is encoded, and video, chapters and metadata are left out, with bit-exact flags keeping the bytes reproducible for the pinned ffmpeg. Even with source metadata removed, each recorded MP3 output still begins with an ID3v2 tag written by the muxer. Inputs whose duration exceeds the service limit are refused before encoding.
04Errors
| Code | HTTP |
|---|---|
invalid_input | 400 |
blocked_target | 403 |
unreachable_target | 424 |
upstream_timeout | 424 |
unsupported_content_type | 415 |
too_large | 413 |
unprocessable | 422 |
internal | 500 |
When each is raised, and what it means for payment: /docs/audio-convert.
05Questions
- What does it cost to convert AIFF to MP3?
- $0.003 per call, paid in USDC on Base via x402.
- How large can the AIFF file be?
- Up to 100 MB (104,857,600 bytes), and at most 60 min (3,600 s) of media. Past a limit the call answers too_large (413).
- What happens if the conversion fails?
- The tool answers with a typed JSON error from the errors table. Payment is settled only after the tool has produced its result; a call that fails inside the tool is never settled.