---
title: "Image generation API · OpenAI-compatible, hosted in the EU"
description: "Generate images from text prompts with an OpenAI-compatible images API. Open image models such as FLUX.1 schnell, processed in EU data centres."
canonical: "https://inference.eu/api/images/"
language: "en"
---

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.

[Contact sales](https://inference.eu/contact/)[Example request](#example)

1.  01API format: OpenAI
2.  02EU data centres
3.  03Covered by one DPA

POST /v1/images/generations

```
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.png
```

## What 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

Endpoint

POST /v1/images/generations

Category

Endpoints

API format

OpenAI

Base URL

api.inference.eu/v1

Processing

EU data centres

Training on your data

Never

## Image generation: common questions

The questions buyers, developers and legal teams ask us most. Something missing? Ask us directly.

Yes. The endpoint uses the same path, request fields (\`model\`, \`prompt\`, \`n\`, \`size\`, \`response\_format\`) and response shape as OpenAI's image generation API. \`client.images.generate\` in the OpenAI SDKs works with the inference.eu base URL and key and an open model id.

The catalogue includes open image models such as FLUX.1 schnell. Call \`GET /v1/models\` to see the image models your key can use, and read each model page for supported sizes and licence. If you need a specific open model, ask us and we will check whether we can run it.

That depends on the licence of the image model, which is shown on its model page. FLUX.1 schnell is released under the Apache 2.0 licence, which allows commercial use. Other models have different terms, so check before you publish, and respect trademarks and people's rights in what you generate.

Each model supports a set of resolutions, commonly square sizes such as \`1024x1024\` and landscape or portrait sizes of similar total pixel count. Pass \`size\` as width by height. If you request an unsupported size, the error message lists the accepted ones.

Use \`b64\_json\` when your code saves or uploads the image immediately; it avoids a second download and never expires. Use \`url\` when you want small responses and will fetch the file within a short time. Download URLs are temporary, so do not store them as the permanent link to an image.

This page covers text to image generation. Editing an existing picture depends on the models available to your key; tell us what you need, such as background replacement or inpainting, and we will tell you which models and requests support it.

No. Prompts are processed in EU data centres to generate the images and are not used to train models. Images returned as \`b64\_json\` exist only in the response; images returned as \`url\` are kept just long enough for you to download them.

Image models draw text as shapes and often misspell it, especially in longer phrases. Ask for an image without text and add headings, prices and logos in your design tool afterwards. Short single words come out better than sentences, but check them before publishing.

[Ask a question](https://inference.eu/contact/)

## Related

[API overview](https://inference.eu/api/)

-   [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](https://inference.eu/api/vision/)
-   [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](https://inference.eu/api/chat-completions/)
-   [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](https://inference.eu/api/models/)

## 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
