Video generation (4-second clip)
POST /v1/videos/generationsText-to-video over x402 - one silent 4-second 720p clip (MP4, inline base64) for a flat $0.20, served by Veo 3.1 Lite. Choose aspect_ratio 16:9 (default) or 9:16; duration, resolution and audio are fixed so the price is. The call returns when the clip is ready (about 40 seconds measured, up to 4 minutes); a failed or timed-out generation is never charged.
Input
| Field | Type | Description |
|---|---|---|
prompt * | string | Text description of the clip (up to 2,000 chars) |
aspect_ratio | string | 16:9 (default, 1280x720) or 9:16 (720x1280) |
Example output
{
"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"
}
],
"usage": {
"generation_seconds": 40
}
}
Try it - see the 402 challenge (free)
curl -i -X POST https://agent402.tools/v1/videos/generations \
-H "Content-Type: application/json" \
-d '{"prompt":"A paper boat drifting down a rain-soaked gutter, close up, cinematic","aspect_ratio":"16:9"}'
The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:
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();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/v1/videos/generations", {
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"
}),
});
Related tools
Chat completions - nano tier
POST /v1/nano/chat/completionsOpenAI-compatible chat completions, nano tier: gpt-4.1-nano, gpt-5-nano, gemini flash-lite, small llama/ministral/qwen, …
try in playground →Chat completions - auto tier (eval-ranked routing)
POST /v1/auto/chat/completionsOpenAI-compatible chat completions with server-side model choice: omit "model" (or send "auto") and the gateway routes t…
try in playground →Grounded chat (web search, OpenAI-compatible)
POST /v1/grounded/chat/completionsOpenAI-compatible chat completions GROUNDED in a live web search on every call: the gateway runs an Exa search (up to 5 …
try in playground →