Agent402 / tools / image-gen-premium

Image generation (Premium)

$0.300 per call · USDC via x402 · POST /api/image-gen-premium

Generate a premium image from a text prompt using GPT Image 2 (medium quality, 1024x1024). Flagship model with best detail and coherence. No API key needed; pay per call via x402. Returns base64 PNG. Prompt capped at 4000 chars.

Input

FieldTypeDescription
prompt *stringText description of the desired image (max 4000 chars)

Example output

{
  "model": "gpt-image-2",
  "provider": "openai",
  "quality": "medium",
  "size": "1024x1024",
  "image": "<base64-encoded PNG>",
  "revised_prompt": "A single red apple on a white background"
}

Try it — see the 402 challenge (free)

curl -i -X POST https://agent402.tools/api/image-gen-premium \
  -H "Content-Type: application/json" \
  -d '{"prompt":"A single red apple on a white background"}'

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/api/image-gen-premium", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "prompt": "A single red apple on a white background"
  }),
});

Wallet-only. This tool reaches the network/browser/storage, so it is paid in USDC via x402 (no proof-of-work tier).

Related tools

LLM inference

USDC $0.010 · POST /api/llm

LLM inference proxy — send an OpenAI-format chat/completions request and get a response from GPT-4o-mini. No API key nee…

LLM inference (Pro)

USDC $0.100 · POST /api/llm-pro

LLM inference proxy (Pro tier) — GPT-4o or GPT-4.1. Same OpenAI-format interface as /api/llm but with more capable model…

LLM inference (Premium)

USDC $0.500 · POST /api/llm-premium

LLM inference proxy (Premium tier) — o3-mini reasoning model via the same OpenAI-format interface. No API key needed; pa…