Image Generation
Flow AI generates images through the OpenAI Images API: POST /v1/images/generations to create images from a prompt, and POST /v1/images/edits to change an image you send.
Find an image model
- On the Models page, pick the Image type. Each model’s page lists its sizes, qualities and price.
- From the API,
GET /v1/modelslists the models your key can call; image models have"mode": "image".
Generate an image
The samples use the OpenAI SDK set up as in the Quickstart.
Edit an image
POST /v1/images/edits takes one or more images and a prompt describing the change. Add a mask (a PNG the same size as the image) whose transparent areas mark where to edit. It’s sent as a form upload, like OpenAI’s.
Options
Any other field is removed before the request reaches the model.
Sizes, qualities and counts are checked first
Before anything is held, Flow AI checks size, quality and n against what the model offers. A value it doesn’t offer is refused with a 400 that lists what it does offer:
The model makes exactly the size, quality and number of images you were held for.
Response
Every image comes back as a link, in data[].url:
- Images are never returned as base64, so
response_formathas no effect. - Flow AI stores each image before it answers, so the link works even after the model’s host has dropped it. Download the images you want to keep.
usageappears for models billed by tokens.
Best practices
- Be specific. Subject, setting, style, lighting and framing all help: “a ceramic mug on an oak desk, top-down, soft window light” beats “a mug”.
- Start small. Try prompts at low quality or a small size, then make the final image at the size you need.
- Ask for one image at a time while exploring.
nmultiplies the cost. - Keep your own copy. Download images you need for the long term.
Troubleshooting
400 naming sizes or qualities. The model doesn’t offer the size, quality or n you asked for. Use one from the message, or from the model’s page.
400 ... does not take ... content or not available right now. The model can’t take this request at the moment. Try another image model.
404 not_found. The model id is wrong, or it isn’t an image model. Check GET /v1/models.
402 insufficient_balance. The request is held for every image at the size and quality you asked for; lower n or quality, or deposit.
Billing
Each image model is priced one of two ways, shown on its page:
- Per image, by size and quality. A request is held for
nimages at the price for its size and quality. - By tokens, for models that charge for the prompt and the image’s tokens. A request is held for its prompt plus a reserve for each image.
Either way, you’re charged what the model actually made, and the rest of the hold is released.