Skip to content

Fast image generation (OpenAI-compatible, budget)

$0.02 per callUSDC via x402POST /v1/images/fast

Budget text-to-image over x402 - OpenAI images wire (prompt in, inline base64 out) at $0.02 per picture, a quarter of the flagship /v1/images/generations price. Send POST /v1/images/fast with the required field prompt and pay $0.02 per call over x402 with USDC on an EVM chain or MPP. It returns a JSON object with created, model, data and usage.

Served by FLUX.2 Klein 4B (about 2 seconds per image, 1024x1024 JPEG) with FLUX 3 Image Klein, then Recraft V4.1 Flash (WebP), as the failover. n locked to 1, text-to-image only, size and quality fixed. Point any OpenAI SDK's images.generate() at base_url https://agent402.tools/v1 and call /images/fast.

Category: LLM gatewayTags: image-generation images text-to-image generate generate-image create-image picture cheapAlso found as: fast-image-generation budget-image-generation

Try in playground →

Parameters

NameTypeRequiredDescription
promptstringyesText description of the image to generate (up to 4,000 chars) Also accepted as text, input, description, q, query.

Example request

curl -i -X POST https://agent402.tools/v1/images/fast \
  -H "Content-Type: application/json" \
  -d '{"prompt":"A minimalist line drawing of a lighthouse at dawn"}'

Without payment this returns HTTP 402 Payment Required with the exact price for v1-images-fast; any x402 v2 or MPP client pays it and retries.

Watch a call get paid

RequestPOST /v1/images/fast
402$0.02 USDC
SignPAYMENT-SIGNATURE
Settleon 11 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "created": 1750000000,
  "model": "black-forest-labs/flux.2-klein-4b",
  "data": [
    {
      "b64_json": "/9j/4AAQSkZJRgABAQAAAQABAAD…",
      "media_type": "image/jpeg"
    }
  ],
  "usage": {
    "prompt_tokens": 11,
    "completion_tokens": 4096,
    "total_tokens": 4107
  }
}
FieldTypeAlways presentIn the example
creatednumberyes1750000000
modelstringyesblack-forest-labs/flux.2-klein-4b
dataarray of objectsyes1 item in the example
usageobjectyes3 fields: prompt_tokens, completion_tokens, total_tokens

From an MCP client

catalog.call {
  "slug": "v1-images-fast",
  "params": {
    "prompt": "A minimalist line drawing of a lighthouse at dawn"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for v1-images-fast; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.14.0.

Errors and behavior

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();
client.setSpendControls?.({ maxAmountPerPayment: "$0.02" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/v1/images/fast", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "prompt": "A minimalist line drawing of a lighthouse at dawn"
  }),
});

Related tools

Pro image generation (OpenAI-compatible)

$0.05POST /v1/images/pro

Higher-fidelity text-to-image over x402 - OpenAI images wire (prompt in, inline base64 out) at $0.05 per picture.

Image gen (OpenAI-compatible)

$0.08POST /v1/images/generations

OpenAI-compatible image generation over x402 - point any OpenAI SDK's images.generate() at base_url.

Image edit (OpenAI-compatible)

$0.02POST /v1/images/edits

Edit an image with a prompt (model-backed) over x402 - OpenAI images.edit wire (reference images and a prompt in, inline.

Video generation (4-second clip)

$0.20POST /v1/videos/generations

Text-to-video over x402 - one silent 4-second 720p clip (MP4, inline base64) for a flat $0.20, served by Veo 3.1 Lite.

Text-to-speech (OpenAI-compatible)

$0.06POST /v1/audio/speech

OpenAI-compatible text-to-speech over x402 - point any OpenAI SDK's audio.speech.create() at base_url.

Chat completions (OpenAI-compatible)

from $0.02POST /v1/chat/completions

OpenAI-compatible chat completions, base tier: point any OpenAI SDK at base_url https://agent402.tools/v1 and pay per.