POST /v1/images/generationsOpenAI-compatible image generation over x402 — point any OpenAI SDK's images.generate() at base_url https://agent402.tools/v1 and pay $0.08 per image in USDC, no API key, no signup. Served by Gemini 2.5 Flash Image (nano banana); prompt in (up to 4k chars), inline base64 image out (response_format b64_json). One image per call (n locked to 1). Optional zdr:true routes only to zero-data-retention providers.
| Field | Type | Description |
|---|---|---|
prompt * | string | Text description of the image to generate (up to 4,000 chars) |
zdr | boolean | Optional — true routes only to zero-data-retention providers |
{
"created": 1750000000,
"model": "google/gemini-2.5-flash-image",
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA…",
"media_type": "image/png"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 1290,
"total_tokens": 1304
}
}
curl -i -X POST https://agent402.tools/v1/images/generations \
-H "Content-Type: application/json" \
-d '{"prompt":"A minimalist watercolor of a fox reading a newspaper in a forest clearing"}'
The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:
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/images/generations", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"prompt": "A minimalist watercolor of a fox reading a newspaper in a forest clearing"
}),
});
POST /v1/nano/chat/completionsOpenAI-compatible chat completions, nano tier: gpt-4.1-nano, gpt-5-nano, gemini flash-lite, small llama/ministral/qwen, …
POST /v1/auto/chat/completionsOpenAI-compatible chat completions with server-side model choice: omit "model" (or send "auto") and the gateway routes t…
POST /v1/chat/completionsOpenAI-compatible chat completions over x402 — point any OpenAI SDK at base_url https://agent402.tools/v1 and pay per ca…