POST /v1/images/generations
Image generation API: OpenAI-compatible, processed in the EU
The image generation endpoint creates pictures from a text description with open image models. It follows the OpenAI images API, so tools and code that call `/v1/images/generations` work after a base URL change. Prompts, which often describe unreleased products or campaigns, are processed in European data centres.
- 01API format: OpenAI
- 02EU data centres
- 03Covered by one DPA
curl https://api.inference.eu/v1/images/generations \
-H "Authorization: Bearer $INFERENCE_EU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-1-schnell",
"prompt": "Product photo of a ceramic coffee mug on a light oak table, soft morning light, plain background",
"n": 1,
"size": "1024x1024",
"response_format": "b64_json"
}' | jq -r '.data[0].b64_json' | base64 --decode > mug.pngWhat the endpoint does
POST /v1/images/generations takes a model and a prompt and returns one or more generated images. The response has a created timestamp and a data array; each item contains either b64_json, the image encoded as base64, or a url to download it, depending on response_format.
Open models such as FLUX.1 schnell, from the German lab Black Forest Labs, produce good results in few steps, which suits drafts, illustrations and product mock-ups. Each model page lists the sizes, licence and strengths of the image models we run, and GET /v1/models shows which ones your key can use.
Key request fields
prompt is the description of the image. Concrete prompts work best: subject, setting, lighting, style and composition, in that order, rather than a list of adjectives. n sets how many images to generate in one request, and size the resolution as width by height, for example 1024x1024 or 1344x768, within the sizes the model supports.
response_format is b64_json or url. Base64 is simplest when you save images straight away, as in the example. A URL keeps responses small but expires after a short time, so download the file promptly. Fields that only apply to OpenAI's own image models, such as their quality and style settings, are ignored.
A practical pattern for content teams
A common setup lets a chat model write the image prompt. Give it the article, product description or campaign brief and ask for a prompt that follows a fixed structure and your brand's visual rules, then send that prompt to the images endpoint. Generate three or four variants with n and let a person pick one.
Keep the prompt and model with each image you publish so you can recreate or adjust it. For large catalogues, such as one illustration per product, run the requests from a queue with retries rather than from a page that a user is waiting on.
Errors and edge cases
An unsupported size returns a 400 error that lists the accepted sizes for the model. Prompts that ask for clearly illegal content are refused with an error rather than an image. Generation is heavier than text, so expect each request to take seconds, set a generous client timeout, and retry 429 and 5xx responses with backoff.
Image models are weak at exact text in images, precise counts and real people's likenesses. Add text and logos afterwards in your design tool. Check the model licence before commercial use, and label generated images where the law or your own policy asks for it.
Image generation: common questions
The questions buyers, developers and legal teams ask us most. Something missing? Ask us directly.
Related
- VisionSend images to open vision models with the OpenAI chat format. Read receipts, screenshots, forms and photos, with requests processed in EU data centres.Guides
- Chat completionsSend chat messages to open-weight models with the OpenAI chat completions format. Requests are processed in EU data centres and never used for training.Endpoints
- List modelsList the open-weight models your inference.eu key can use with GET /v1/models, in the OpenAI format. Pick model ids for chat, embeddings, speech and more.Endpoints
Move your AI workloads to EU infrastructure
Tell us which models you use and roughly how much traffic you have. We reply within one working day with pricing and next steps.
- Reply within one working day
- Pricing for your volume
- DPA ready to sign