Fast image generation (OpenAI-compatible, budget)
POST /v1/images/fastBudget 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. Served by FLUX.2 Klein 4B (about 2 seconds per image, 1024x1024 JPEG) with GPT Image 1 Mini 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.
Input
| Field | Type | Description |
|---|---|---|
prompt * | string | Text description of the image to generate (up to 4,000 chars) |
Example output
{
"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
}
}
Try it - see the 402 challenge (free)
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"}'
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/fast", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"prompt": "A minimalist line drawing of a lighthouse at dawn"
}),
});
Related tools
Chat completions - nano tier
POST /v1/nano/chat/completionsOpenAI-compatible chat completions, nano tier: gpt-4.1-nano, gpt-5-nano, gemini flash-lite, small llama/ministral/qwen, …
try in playground →Chat completions - auto tier (eval-ranked routing)
POST /v1/auto/chat/completionsOpenAI-compatible chat completions with server-side model choice: omit "model" (or send "auto") and the gateway routes t…
try in playground →Grounded chat (web search, OpenAI-compatible)
POST /v1/grounded/chat/completionsOpenAI-compatible chat completions GROUNDED in a live web search on every call: the gateway runs an Exa search (up to 5 …
try in playground →