Images
Generate and edit images.
POST /v1/images/generations submits an image job. It answers 202 with a job; see
How media jobs work for polling and output.
curl https://api.opinference.com/v1/images/generations \
-H "Authorization: Bearer $OP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "black-forest-labs/flux-1-schnell",
"prompt": "A lighthouse at dawn, watercolor.",
"width": 1024,
"height": 1024,
"output_format": "PNG"
}'Inputs
Inputs differ per model. Common ones:
| Input | Meaning |
|---|---|
prompt | What to draw |
negative_prompt | What to avoid |
width, height | Size in pixels. Some models require both |
n | How many images. Each one is billed |
seed | Repeat a result |
output_format | File type, where the model offers a choice |
image | A source image to edit or vary, as an https URL |
mask | The area of image to repaint |
The model's page at opinference.com/models lists exactly which inputs it takes, which are required, and their ranges. See Inputs for how media inputs are passed.
Output
One output[] entry per image, with its type (such as image/png), size and checksum.
usage.units.images counts them.