Video clip (4 seconds, fixed price)
POST /v1/videos/clipText-to-video (model-backed) over x402 at a fixed price: one silent 4-second 720p clip (MP4, inline base64) for $0.25, from Veo 3.1 Lite with Grok Imagine Video 1.5 Lite as the failover.
Details
Text-to-video (model-backed) over x402 at a fixed price: one silent 4-second 720p clip (MP4, inline base64) for $0.25, from Veo 3.1 Lite with Grok Imagine Video 1.5 Lite as the failover. aspect_ratio is 16:9 (default) or 9:16; 1:1, 4:3, 3:4, 3:2 and 2:3 come from the second model alone. For a longer clip or sound, priced per second, use /v1/videos/generations. The call returns when the clip is ready, up to 4 minutes. A failed or timed-out generation is not charged on x402 (a filtered one answers 422 with reason content_filtered), and a wallet payer whose request timed out can resend it unchanged to collect the same clip. Takes up to 4 minutes 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=240" and keep the connection open for at least 270 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 |
|---|---|---|---|
prompt | string | yes | Text description of the clip (up to 2,000 chars) Also accepted as text, input, description, q, query. Up to 2000 characters. |
aspect_ratio | string (one of: 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3) | no | 16:9 (default, 1280x720) or 9:16 (720x1280); 1:1, 4:3, 3:4, 3:2 and 2:3 are made by the second model alone One of 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3. |
Example request
curl -i -X POST https://agent402.tools/v1/videos/clip \
-H "Content-Type: application/json" \
-d '{"prompt":"A paper boat drifting down a rain-soaked gutter, close up, cinematic","aspect_ratio":"16:9"}'Watch a call get paid
POST /v1/videos/clip$0.25 USDCPAYMENT-SIGNATUREon 11 chains200 OKAgent402-ReceiptEd25519Example response
{
"created": 1750000000,
"model": "google/veo-3.1-lite",
"data": [
{
"b64_json": "AAAAIGZ0eXBpc29t…",
"media_type": "video/mp4",
"duration_seconds": 4,
"resolution": "720p",
"aspect_ratio": "16:9",
"audio": false
}
],
"usage": {
"generation_seconds": 40
}
}| Field | Type | Always present | In the example |
|---|---|---|---|
created | number | yes | 1750000000 |
model | string | yes | google/veo-3.1-lite |
data | array of objects | yes | 1 item in the example |
usage | object | yes | 1 field: generation_seconds |
From an MCP client
catalog.call {
"slug": "v1-videos-clip",
"params": {
"prompt": "A paper boat drifting down a rain-soaked gutter, close up, cinematic",
"aspect_ratio": "16:9"
}
}Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.21.0): pays from a wallet or AGENT402_CREDITS_KEY.
Errors and behavior
- Pay $0.25 per call over x402 with USDC on an EVM chain or MPP. Wallet-only, model-backed: no proof-of-work tier; the same input can give a different result. A prepaid card-credits key (
Authorization: Bearer a402_...) also pays it. - Required:
prompt; a rejected input answers 4xx witherror,tool,expected,requiredandexample. - On this route, a call ending in any status of 400 or above is not charged over x402, MPP or a credits key.
Prefer: respond-asyncanswers202with a job link to poll (GET /api/jobs/{id}), and its payment settles only when the answer is ready. - Sales tax: the price includes North Carolina sales tax for a card buyer billed to a North Carolina address.
- Long-running: x402 is offered on EVM chains only and MPP on Base or Celo; Tempo is not offered.
- A bodyless
GETorHEADreturns the same 402 quote. - An
Idempotency-Keyreplays the first 200 uncharged (an answer larger than 1 MB or streamed 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.25" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/v1/videos/clip", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"prompt": "A paper boat drifting down a rain-soaked gutter, close up, cinematic",
"aspect_ratio": "16:9"
}),
});Get a wallet or run npx -y agent402-mcp@0.21.0 wallet new.
The quote (Python)
import base64, json, urllib.error, urllib.request
req = urllib.request.Request("https://agent402.tools/v1/videos/clip", method="POST", data="{\"prompt\":\"A paper boat drifting down a rain-soaked gutter, close up, cinematic\",\"aspect_ratio\":\"16:9\"}".encode(), headers={"Content-Type": "application/json"})
try:
urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]]) # the price, per chain, in base units