Onchain Router · Images Generations

by Onchain Router

POSTBase

$0.035

per call · USD Coin on Base

Image generation · seven-day hosted URL · 0% service fee launch promotion

Endpoint

POST https://onchainrouter.dev/v1/images/generations

4

Calls / 30d

1

Unique payers / 30d

Sep 6

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://onchainrouter.dev/v1/images/generations", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "aspect_ratio": "1:1",
    "image_size": "1K",
    "model": "gemini-3.1-flash-lite-image",
    "n": 1,
    "prompt": "A small observatory beneath a clear night sky, editorial illustration",
    "response_format": "url"
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://onchainrouter.dev/v1/images/generations" \
  -H "Content-Type: application/json" \
  -d '{"aspect_ratio":"1:1","image_size":"1K","model":"gemini-3.1-flash-lite-image","n":1,"prompt":"A small observatory beneath a clear night sky, editorial illustration","response_format":"url"}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "aspect_ratio": "1:1",
  "created": 0,
  "data": [
    {
      "backed_up": true,
      "url": "https://onchainrouter.dev/v1/media/images/00000000-0000-4000-8000-000000000000?access=capability"
    }
  ],
  "image_size": "1K",
  "model": "gemini-3.1-flash-lite-image",
  "price": {
    "amount": "0.035",
    "currency": "USD"
  }
}

Payment details

Pay to0xa7660dea6aadcc87cbb5e79ccd262d391e61de5d
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase
Schemesexact

Is this your API?

Pin it to the top of Media & Generation and the homepage with a featured placement.

Get featured →

More from Onchain Router & similar services