HTTP/1.1 402 PAYMENT REQUIRED agent402.base.eth · BASE · SOLANA · POLYGON · ARBITRUM · STELLAR · ROBINHOOD · USDC · USDG
Agent402 / tools / v1-images

Image generation (OpenAI-compatible)

$0.080 per call · USDC via x402 · POST /v1/images/generations

OpenAI-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.

Input

FieldTypeDescription
prompt *stringText description of the image to generate (up to 4,000 chars)
zdrbooleanOptional — true routes only to zero-data-retention providers

Example output

{
  "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
  }
}

Try it — see the 402 challenge (free)

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:

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/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"
  }),
});
Wallet-only. This tool reaches the network/browser/storage, so it is paid in USDC via x402 (no proof-of-work tier).

Related tools

Chat completions — nano tier

$0.003 · POST /v1/nano/chat/completions

OpenAI-compatible chat completions, nano tier: gpt-4.1-nano, gpt-5-nano, gemini flash-lite, small llama/ministral/qwen, …

Chat completions — auto tier (eval-ranked routing)

$0.01 · POST /v1/auto/chat/completions

OpenAI-compatible chat completions with server-side model choice: omit "model" (or send "auto") and the gateway routes t…

Chat completions (OpenAI-compatible)

$0.02 · POST /v1/chat/completions

OpenAI-compatible chat completions over x402 — point any OpenAI SDK at base_url https://agent402.tools/v1 and pay per ca…