Skip to main content
Image generation is synchronous and OpenAI-shaped: send a prompt, get back base64-encoded PNGs in the response body. Find image-capable models by their category of image — see model discovery. The example below uses FLUX.1-schnell.

Example

Request fields

Response

Decode b64_json with your language’s base64 helper and write the bytes as a .png.

Billing

Image models bill per output image, not per token. Read the active rate from GET /v1/pricing — find the row for your model, where pricing_type is per_image, and take unit_price_usd (rates can vary by resolution tier). A model that is temporarily not serving has no row until it is back. The billing reference explains how that becomes a charge. If you are already calling GET /v1/models to discover the model, its media_pricing array carries the same rates on the same entry, which saves the second round trip. One difference to watch: media_pricing reports the raw billing_unit, so an image model reads image or megapixel there where /v1/pricing reports both as the single pricing_type of per_image. Both surfaces quote the same unit_price_usd.