How do you generate images with an AI API, and what does one image cost?
In short: You send a model name and a prompt to the OpenAI-style /v1/images/generations endpoint, and the image comes back as base64. On the Wiozen API, as of October 30, 2026, one image costs $0.0102 with FLUX.2 Klein 4B, about $0.047 with Gemini 3.1 Flash Image, and about $0.116 or $0.148 with GPT Image 2.5 depending on size. You're only charged once the image reaches you.
Which models can generate images?
The endpoint only accepts active models listed in the image generation category on the Models page. As of October 30, 2026 there are three: flux-2-klein-4b, gemini-3.1-flash-image and gpt-image-2.5. Any other name returns 400.
There are two shortcuts. If you leave model empty, or use a name containing dall-e (say, a dall-e-3 left over in old code), the request goes to Gemini 3.1 Flash Image. So a tool written for DALL-E works once you change its address.
Roughly: FLUX.2 Klein when you need lots of cheap images, Gemini for editing with a reference image or general use, GPT Image 2.5 for the most detailed result. FLUX.2 Klein doesn't take a reference image.
How do I generate my first image?
Get an API key from the Keys page and put it in the API_KEY environment variable. The shortest request looks like this:
curl https://api.wiozen.com/v1/images/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gemini-3.1-flash-image", "prompt": "A cup of Turkish coffee in morning light, close-up"}'The response uses the OpenAI format, with the image as base64 in data[0].b64_json. OpenAI's official Python library works too; only base_url changes:
import base64
from openai import OpenAI
client = OpenAI(base_url="https://api.wiozen.com/v1", api_key="sk-gw-...")
result = client.images.generate(
model="flux-2-klein-4b",
prompt="A cup of Turkish coffee in morning light, close-up",
size="1536x1024",
)
with open("coffee.png", "wb") as f:
f.write(base64.b64decode(result.data[0].b64_json))You can ask for up to 10 images in one request with n; anything higher is cut to 10. An empty prompt gets 400. For connection details see the OpenAI-compatible API guide, and for every endpoint the docs.
How much does one image cost?
Images aren't billed by tokens. Each model counts a fixed number of units per image, multiplied by the model's output price on the Models page. The amounts below are as of October 30, 2026, when all three models were listed 30% below their official price. The current price is always on the Models page.
| Model | Units per image | Output / 1M | One image |
|---|---|---|---|
flux-2-klein-4b | 1,000 | $10.20 | $0.0102 |
gemini-3.1-flash-image (1K) | 1,120 | $42.00 | ≈ $0.047 |
gpt-image-2.5, 1024×1024 | 7,033 | $21.00 | ≈ $0.148 |
gpt-image-2.5, other sizes | 5,500 | $21.00 | ≈ $0.116 |
For Gemini the math is 1,120 × 42 / 1,000,000 = $0.047. Each request also carries a fixed 500-token input charge: at October 30 prices that's about $0.002 on GPT Image 2.5, $0.0002 on Gemini and nothing on FLUX.2 Klein. Ask for several images with n and the image charge is multiplied by that number, while the input charge is taken once.
Say a blog needs 300 featured images a month: that's about $3 with FLUX.2 Klein, about $14 with Gemini and about $35 with GPT Image 2.5 at a landscape size. If the model reports its own token usage with the response, the charge is calculated from that usage instead of the fixed number in the table.
Am I charged if the image fails or the connection drops?
When a request starts, an estimate is held from your balance, and the real amount is written once the image reaches you. If the model returns an error, the hold is released. If your client disconnects before the response arrives (a timeout, a closed tab), generation is cut off too and nothing is charged.
When you ask for Gemini 3.1 Flash Image and Gemini can't answer at that moment, FLUX.2 Klein produces the image, and if that fails too, GPT Image 2.5. You pay the price of the model that made the image, and the Usage page shows that model's name. That's why the hold at the start is the amount for the most expensive model in the chain; if your balance can't cover it, the request gets 429. Asking for FLUX.2 Klein or GPT Image 2.5 directly means no fallback is tried.
If you've put a spend limit on your key, the image endpoints count toward it as well.
How do I generate from a reference image?
To change an existing image or make one like it, add an image field to the request. Its value is the image as base64, or a data URI such as data:image/png;base64,.... In the Python library you send it with extra_body={"image": ...}.
Reference requests work with Gemini 3.1 Flash Image or GPT Image 2.5. When you send one to Gemini, FLUX.2 Klein is skipped in the fallback chain and GPT Image 2.5 comes next. A full example is in the docs.
Frequently asked questions
Will my code written for DALL-E work?
Yes, set base_url to https://api.wiozen.com/v1. Names like dall-e-3 are sent to Gemini 3.1 Flash Image and billed at its price.
Which image model is cheapest?
As of October 30, 2026, FLUX.2 Klein 4B: $0.0102 per image with no input charge. It doesn't take a reference image.
How many images can I get from one request?
Up to 10 with n. Each image is charged separately.
Do I pay if the connection drops before the image arrives?
No. If the client leaves before the response, generation stops and nothing is charged. A model error isn't charged either.
Does image size change the price?
Only on GPT Image 2.5: about $0.148 at 1024×1024 and about $0.116 at other sizes. On FLUX.2 Klein and Gemini the size doesn't change the price.
Create a key, run the curl command above, and compare prices on the Models page.
More guides: How can you use an AI API from Turkey without a credit card? · How do you connect an OpenAI-compatible API to a tool you already use? · How do you calculate the cost of an AI API? · What should I do if my AI API key has leaked? · Why does my AI API return a 429 error, and how do I fix it? · Why do long AI API requests time out: streaming or non-streaming? · Anthropic Messages API or OpenAI Chat Completions: which one should I use? · What is a context window, and what is a 1 million token context good for? · Which AI model should I choose: deciding by price, context and quality · Why does a reasoning model return an empty answer, and why are thinking tokens charged? · Why is my API balance running out faster than expected? Tracking spend request by request · How do you convert a web page to Markdown to feed it to an AI model? · How do you get AI to write and publish articles in WordPress automatically? · How do you find blog topics from RSS feeds and Google Trends? · Does AI-written content show up on Google and in AI answers? · How do you get internal links into AI-written WordPress articles? · How do you get AI to generate a different featured image for every WordPress post? · How do you write a content brief when an AI writes your blog posts? · What should you watch for when an AI writes recipes for your food blog? · How do you fix errors when connecting a WordPress plugin to your AI API account? · Why does my AI article bot stop halfway in WordPress? "Run is stuck" and LiteSpeed · Why are my scheduled WordPress posts late? WP-Cron and a real server cron · How do I get an AI article bot to write blog posts in English or another language? · What does "Content Bot cannot generate articles" mean? Reading the bot's log