Speech-to-text (long recordings)
POST /api/transcribe-longLong-recording tier (model-backed, gpt-transcribe, the same model as the other transcribe tiers): transcribes an audio file at a URL. Send POST /api/transcribe-long with the required field url and pay $0.20 per call over x402 with USDC on an EVM chain or MPP. It returns a JSON object with model, provider, text, language and duration.
Max 30 minutes and 25 MB (thirty minutes fit at up to about 110 kbps; a file that needs converting is sent as 16 kHz mono Opus). Returns the transcript text, language and duration; diarize:true adds speaker labels, word timestamps and a language confidence score (the scribe-v2 model, same price and cap). No API key needed; pay per call via x402. A file whose length cannot be confirmed is transcribed up to the cap, and the answer says so (trimmedToCapSeconds, durationUnconfirmed). A transient upstream failure gets one more attempt inside the same time limit, and an answer served that way says so in agent402_retried. Takes up to 230 seconds to answer: send the paid call with "Prefer: respond-async" to get a job link at once and collect the answer from it (on x402 the payment settles only on a delivered result), or with "Prefer: wait=230" and keep the connection open for at least 260 seconds, because a client that disconnects first loses the answer. A paid call with neither header is answered 400 before any payment is taken.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | yes | URL of the audio file to transcribe (mp3, wav, m4a, ogg, flac, webm), up to 30 minutes and 25 MB Also accepted as link, uri, href, page. |
language | string | no | Optional ISO-639-1 language code (e.g. 'en', 'es', 'fr') for better accuracy |
diarize | boolean | no | true: transcribe with the scribe-v2 model and add speaker labels and word timestamps (`words`, `speakers`) and `language_confidence` (0 to 1, the model's confidence in the detected language). Same price and cap. Default false |
model | string | no | Optional: a model to transcribe with in place of gpt-transcribe, one of mistralai/voxtral-mini-transcribe-3-0, mistralai/voxtral-small-transcribe-3-0 (model-backed; same price and cap; not with diarize). The answer names the model that served it. |
Example request
curl -i -X POST https://agent402.tools/api/transcribe-long \
-H "Content-Type: application/json" \
-d '{"url":"https://agent402.tools/fixtures/sample-speech.wav"}'Without payment this returns HTTP 402 Payment Required with the exact price for transcribe-long; any x402 v2 or MPP client pays it and retries.
Watch a call get paid
POST /api/transcribe-long$0.20 USDCPAYMENT-SIGNATUREon 11 chains200 OKAgent402-ReceiptEd25519Example response
{
"model": "gpt-transcribe",
"provider": "openai",
"text": "Hi, this is the Agent402 sample recording. Can you hear me clearly? Yes, loud and clear. There are two of us on this clip, so the transcript can tell us apart.",
"language": "en",
"duration": 12.6
}| Field | Type | Always present | In the example |
|---|---|---|---|
model | string | yes | gpt-transcribe |
provider | string | yes | openai |
text | string | yes | Hi, this is the Agent402 sample recording. Can you hear me clearly? Yes, loud... |
language | string | yes | en |
duration | number | yes | 12.6 |
trimmedToCapSeconds | number | no | Present only when the file's length could not be confirmed: the audio was transcribed up to this many seconds (the tier's cap) |
durationUnconfirmed | boolean | no | Present (true) only with trimmedToCapSeconds: the file's full length was not confirmed |
From an MCP client
catalog.call {
"slug": "transcribe-long",
"params": {
"url": "https://agent402.tools/fixtures/sample-speech.wav"
}
}The hosted connector at https://agent402.tools/mcp needs a payment for transcribe-long; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.15.0.
Errors and behavior
urlis required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement runs after the tool and only on a successful response. Some calls are paid before they run; a failed one can be retried free with the same payment, or is refunded.
- Wallet-only: this tool runs a model, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - Model-backed: the answer is generated by a model, so the same input can produce a different result.
- Long-running: payment settles after the work finishes, so x402 is offered on EVM chains only and MPP on Base or Celo; Tempo is not offered.
- Usually answers in about 90 seconds and takes up to 230 seconds. Send the paid call with
Prefer: respond-asyncto get202and a job link at once, then pollGET /api/jobs/{id}for its stage, progress and ETA until it has the answer; payment still settles only when the answer is ready, except a Tempo transfer sent before the call, which is repaid after on-chain proof if the run fails. To wait on the connection instead, sendPrefer: wait=230and keep it open that long. A paid call with neither header is answered400before any payment is taken. - A
GETorHEADto /api/transcribe-long returns the same 402 quote, so the price can be read without a body. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.20" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/transcribe-long", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"url": "https://agent402.tools/fixtures/sample-speech.wav"
}),
});Related tools
Speech-to-text
Transcribe audio to text with the gpt-transcribe model.
Speech-to-text (Pro)
Pro tier for longer recordings (model-backed, gpt-transcribe, the same model as the standard tier): transcribes an audio.
Transcribe (OpenAI-compatible)
OpenAI's own transcription wire: POST multipart/form-data with a `file` part and get the transcript back.
Speech-to-text, long audio (OpenAI transcription wire)
OpenAI's transcription wire on the ten-minute tier: POST multipart/form-data with a `file` part.
Decisions (OpenAI wire)
OpenAI's Decisions API on its own wire: point an OpenAI SDK's base URL here and client.decisions.create works unchanged.
Dub: translate and speak
Translate a text into a target language and speak the translation, in one paid call.