Skip to main content
POST
/
v1
/
images
/
generations
Create image generation
curl --request POST \
  --url https://api.infery.ai/v1/images/generations \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "n": 1,
  "size": "<string>",
  "quality": "<string>",
  "style": "vivid",
  "response_format": "url",
  "aspect_ratio": "<string>",
  "image_size": "<string>",
  "person_generation": "dont_allow",
  "background": "transparent",
  "output_format": "png",
  "output_compression": 123,
  "input_fidelity": "high",
  "moderation": "auto",
  "negative_prompt": "<string>",
  "seed": 123
}
'
{
  "created": 1713204900,
  "data": [
    {
      "url": "/samples/image.png",
      "revised_prompt": "Isometric illustration of a glowing neon-green AI control panel"
    }
  ],
  "credits_used": 40
}
curl https://api.infery.ai/v1/images/generations \
  -H "Authorization: Bearer $INFERY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "An isometric dev dashboard, neon green accents, dark theme",
    "size": "1024x1024",
    "n": 1
  }'

Sample output

Generated image sample
Generated with gemini-2.5-flash-image (Nano Banana).

Response formats

  • response_format: "url" (default) → provider-hosted URL, ephemeral (~1 hour). Download within that window if you need to keep it.
  • response_format: "b64_json" → inline base64 PNG.
To persist the image forever, upload the decoded bytes via POST /v1/files.

Supported models

See Models catalog filtered to image modality. OpenAI (DALL·E), Google (Imagen, Gemini Image), xAI (Grok Image), Alibaba (Qwen Image), Suno-music, FLUX (self-hosted) — all accessed by slug.

Aspect ratios and sizes

Per-model; common values: 1024x1024, 1792x1024, 1024x1792, 512x512. Check a model’s allowedParams.supported_sizes via GET /v1/models/{slug}.

Authorizations

Authorization
string
header
required

API key in format: Bearer inf_***

Body

application/json
model
string
required

Model ID to use for generation

prompt
string
required

Text prompt describing the image to generate

n
integer
default:1

Number of images (model-specific max: DALL-E 3=1, Imagen=4, GPT Image=4, DALL-E 2=10)

size
string

Image size. DALL-E: 256x256-1792x1024. GPT Image: 1024x1024/1024x1536/1536x1024/auto

quality
string

DALL-E: standard/hd. GPT Image: low/medium/high/auto

style
enum<string>

DALL-E only

Available options:
vivid,
natural
response_format
enum<string>
default:url

DALL-E only. GPT Image always returns b64_json

Available options:
url,
b64_json
aspect_ratio
string

Aspect ratio (Google models, see /v1/models for allowed values)

image_size
string

Output resolution: Imagen Standard/Ultra "1K"|"2K", Gemini 3 image "1K"|"2K"|"4K"

person_generation
enum<string>

Person generation policy (Google models)

Available options:
dont_allow,
allow_adult,
allow_all
background
enum<string>

Background type (GPT Image models only)

Available options:
transparent,
opaque,
auto
output_format
enum<string>

Output file format (GPT Image models only)

Available options:
png,
webp,
jpeg
output_compression
integer

Compression 0-100 (GPT Image, jpeg/webp only)

input_fidelity
enum<string>

Match style of input images (GPT Image 1/1.5 only)

Available options:
high,
low
moderation
enum<string>

Content filter level (GPT Image only)

Available options:
auto,
low
negative_prompt
string

What to exclude from the image (Imagen 4)

seed
integer

Seed for reproducibility (Imagen 4)

Response

Image generation result. When stream=true, returns SSE (text/event-stream) with progress events, then a final chunk with the result.

created
integer
Example:

1713204900

data
object[]
Example:
[
  {
    "url": "/samples/image.png",
    "revised_prompt": "Isometric illustration of a glowing neon-green AI control panel"
  }
]
credits_used
integer
Example:

40