How an AI image generator API works

An AI image generator API takes a text prompt in a POST request and returns a finished image, usually as a link or as base64 data you save to a file. Ours runs FLUX models from Black Forest Labs: the standard endpoint returns a 1024×1024 JPEG for $0.03, and the HD endpoint lets you pick the size and a seed for $0.06. There's no sign-up or API key, and you can try both free 5 times a day.

Try it free Image Generation API — pictures from a text prompt · $0.03 / call

Two endpoints, two jobs

Image APIImage HD API
ModelFLUX.1 [schnell]FLUX.2 [klein] 4B
Price per image$0.03$0.06
SizeAlways 1024×1024256 to 1536 px each side (rounded to 16)
SeedNoYes, so you can repeat a result
Bodyprompt, steps (1–8, default 6)prompt, width, height, seed
Good forDrafts, thumbnails, square postsBanners, portrait or wide images, readable text in the picture

The request

Both endpoints take JSON. Prompts can be up to 2,000 characters.

POST https://iamai.markets/api/x402/services/ij0SpjTJvY-K
Content-Type: application/json

{"prompt": "a red bicycle leaning on a white wall, morning light, photo", "steps": 6}

POST https://iamai.markets/api/x402/services/pBOfMSmBCVNq
Content-Type: application/json

{"prompt": "poster with the words OPEN LATE in bold letters, neon sign style",
 "width": 1536, "height": 864, "seed": 42}

Paying and decoding the image

  1. The first answer is HTTP 402 with the price.
  2. An x402 v2 client (or Coinbase AgentKit with the iamai-agentkit npm plugin) pays in USDC on Base and repeats the request with the PAYMENT-SIGNATURE header.
  3. The 200 answer holds result.image_base64 (a JPEG), content_type, width, height and model. Decode the base64 and write it to a .jpg file, or put it straight into an img tag as a data URL.
// Browser or Node 18+, after your x402 client has paid and repeated the call
const { result } = await res.json();
const src = `data:${result.content_type};base64,${result.image_base64}`;
document.querySelector("#preview").src = src;

What it won't do

Other image APIs

OptionWhat it's likeAccount needed
OpenAI image APIStrong prompt following, image editing tooYes, API key and billing
Stability AI APIStable Diffusion family, many tools (upscale, edit)Yes, credits
Replicate, fal.aiMany open models including FLUX, billed by usageYes
Cloudflare Workers AIRuns FLUX models on your own Cloudflare accountYes, Cloudflare account
iamai.markets Image / Image HD$0.03 / $0.06 per image, text to image onlyNo, pay per call with x402

The product

Questions

Can I use the images commercially?

The model's licence allows commercial use of the outputs. Check that your prompt doesn't copy someone else's brand or character.

I don't have a crypto wallet. Can I still use it?

Yes. The AI Image Generator is also on RapidAPI with monthly card plans, starting with a free plan of 10 images: https://rapidapi.com/VPNKorp/api/ai-image-generator32

Do I pay if the generation fails?

No. You're only charged when the call works, and refused prompts cost nothing.

Related

Updated 2026-12-01