Skip to main content

Transcribe an audio recording

ASR converts a complete audio recording into text. Billing uses the validated audio duration, rather than upload or processing time.

Prepare your project​

Follow Set up your project and set ANTAPI_KEY in your terminal or backend. Before calling, check availability and the published duration price in the ASR API reference. A guide can be read before its API Reference is published.

Upload audio​

curl "https://api.antapi.dev/asr/v1/transcribe" \
--header "Authorization: Bearer $ANTAPI_KEY" \
--header 'Idempotency-Key: asr-recording-example-001' \
--form file=@speech.wav

Upload a PCM16 WAV or single-stream Ogg Opus file of at most 8 MiB and 120 seconds. Let your HTTP client set the multipart Content-Type and boundary. Language is detected automatically. For stereo recordings, only the left channel is recognized. Damaged files, chained or multiplexed Ogg streams, and cropped Ogg streams with a nonzero initial offset are rejected.

Read the transcript​

Check HTTP status and the JSON code, data, and error envelope. On success, read data.text and the validated integer data.duration_ms. Do not submit a client-provided duration. Successfully processed silence can produce empty text and remains billable.

Billing and retries​

Audio duration is measured in milliseconds and rounded upward in one-second billing increments. A 3.2-second recording is priced as 4 seconds. Upload and queue time are excluded. Authorization uses a 120-second upper bound; settlement uses the successful audio duration and releases the unused reservation. Failures do not consume billable audio duration. Funding and budget rules are explained in Balance and billing.

For a same-key retry, preserve the exact multipart bytes and Content-Type boundary; rebuilding the upload can cause a same-key input conflict. Replays preserve the original execution and financial facts but do not guarantee another copy of the transcript. A new key may create another paid transcription. A disconnect does not revoke an authorized execution; save X-Request-ID and review usage and receipts when the outcome is uncertain.

Use through MCP​

Follow MCP setup, authorize asr:transcribe, and discover asr_transcribe. Put file: {filename: "speech.wav", data_base64: "<Base64 of actual file bytes>"} inside input, with a saved idempotency_key beside input. Use standard, canonically padded Base64; local file paths, file URLs, and object storage URLs are not accepted. The same 8 MiB, 120-second, and format limits apply. The complete MCP request limit is 134 MiB including Base64 and protocol overhead; clients can impose smaller limits.

Reuse the same file contents, fields, and key for one logical retry. Gateway creates deterministic multipart bytes, so the agent does not manage a boundary. Results contain the public API's JSON data and preserve the original billing and receipts. Availability follows the current release and authorization; existing connections need new consent for the added permission. Live microphone transcription is not provided, and the existing CLI does not include this operation.