x402 · USDC on Base or Solana · live

Text to image, paid per call

Post a prompt and a model, settle the 402 in USDC, and the image comes back in the same response. Seven models, square to 21:9, up to 4K.

POST /api/x402/image · from $0.02

A macro product photograph of a gold ring on dark stone
A photoreal studio portrait with soft key light
A cinematic film still of an armoured figure in neon rain
Three frames from the wall on our chat page, each one generation of Gemini 2.5 Flash Image, which is nano-banana, the default here. Made on our own account, not bought here.Gemini 2.5 Flash Image

Try it

1 · Ask for the price (free)
curl -i -X POST https://www.trezalabs.com/api/x402/image \
  -H 'Content-Type: application/json' \
  -d '{"prompt":"a lighthouse on a sea cliff at golden hour, soft mist, cinematic wide shot","model":"nano-banana","aspectRatio":"1:1"}'

Without a payment this answers 402 Payment Required, with the price for exactly this body, the USDC token and the address to pay in the PAYMENT-REQUIRED header. Nothing is charged.

2 · Pay and collect, with Coinbase's awal wallet
npx awal@latest x402 pay https://www.trezalabs.com/api/x402/image \
  -X POST \
  -d '{"prompt":"a lighthouse on a sea cliff at golden hour, soft mist, cinematic wide shot","model":"nano-banana","aspectRatio":"1:1"}' \
  --max-amount 60000

awal reads the 402, pays it from your agentic wallet in USDC on Base, repeats the request and prints the response. --max-amount caps the payment in USDC units of a millionth: 60,000 is $0.06, this body's price. Any other x402 client works the same way.

Or just read what it asks for
npx awal@latest x402 details https://www.trezalabs.com/api/x402/image

Price

Quoted per request in the 402, so read it from there rather than hard-coding it. A render that fails gets a free retry.

Limits

  • prompt: up to 2,000 characters.
  • Returns an image URL in the JSON response, with a statusUrl you can GET again for free.
  • 60 requests per hour per IP address, before any payment is looked at.
  • Paid in USDC on Base or Solana. Fields the endpoint does not read are refused before payment, not charged for and ignored.
  • Aspect ratios run from 1:1 to 21:9, as each model sells them; a bare GET lists them per model.
  • resolution (Nano Banana 2 and Pro, Seedream) or quality (GPT Image 2) is the one setting that moves the price.

A bare GET /api/x402/image answers with the whole menu as JSON.

What a paid call returns
{
  "runId": "2026-09-23T18:04:11.000Z#1a2b3c4d",
  "status": "success",
  "image": "https://www.trezalabs.com/api/media/generated/x402_image/1a2b3c4d.png?s=...&c=...",
  "statusUrl": "https://www.trezalabs.com/api/x402/image?runId=...&token=...",
  "paidUsd": 0.06,
  "model": "nano-banana",
  "aspectRatio": "1:1",
  "transaction": "0x..."
}