Image Generations

Generate images from text prompts using DALL-E, GPT-Image, and more.

Generate images from a text prompt. The endpoint mirrors OpenAI's images.generate so any OpenAI SDK works out of the box - just point baseURL at https://api.aivene.com/v1.

POST /v1/images/generations

Authentication

AuthorizationBearerrequired

API key as bearer token in the Authorization header. Create keys at Manage API Keys.

Headers

Content-Typestringrequired

Must be application/json.

Body

promptstringrequired

Text description of the image to generate. Be specific and detailed for best results.

modelstringrequired

Image model id from GET /v1/models. Example: dall-e-3, gpt-image-1, flux-pro.

nintegeroptionalDefault 1

Number of images to generate. Some models only support 1.

sizestringoptionalDefault 1024x1024

Output dimensions. Available sizes depend on the model.

Allowed values:256x256512x5121024x10241792x10241024x1792
qualitystringoptionalDefault standard

Image quality. hd produces finer details (DALL-E 3). low, medium, high for gpt-image-1.

Allowed values:standardhdlowmediumhigh
stylestringoptionalDefault vivid

Visual style. vivid is more dramatic, natural is more realistic. Only supported by DALL-E 3.

Allowed values:vividnatural
backgroundstringoptional

Background transparency. Only supported by gpt-image-1.

Allowed values:transparentopaqueauto
response_formatstringoptionalDefault url

url returns a temporary URL (valid ~1 hour), b64_json returns inline base64 data.

Allowed values:urlb64_json
userstringoptional

End-user identifier for abuse tracking. safety_identifier is accepted as an alias.

URL expiration

URLs returned with response_format: 'url' expire after approximately 1 hour. Download and store images promptly, or use b64_json for persistence.

Response

createdintegeroptional

Unix timestamp (seconds) when the images were generated.

dataImage[]optional

Array of generated images. Each contains either url or b64_json depending on response_format, plus revised_prompt if the model rewrote your prompt.

Example

curl https://api.aivene.com/v1/images/generations \
  -H "Authorization: Bearer $AIVENE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "A serene Japanese garden with cherry blossoms in spring",
    "n": 1,
    "size": "1024x1024",
    "quality": "hd"
  }'

Response:

{
  "created": 1715000000,
  "data": [
    {
      "url": "https://...",
      "revised_prompt": "A tranquil Japanese garden featuring blooming cherry blossom trees..."
    }
  ]
}

Model comparison

ModelSizesQualityNotes
dall-e-31024x1024, 1792x1024, 1024x1792standard, hdBest for artistic images, auto-rewrites prompts
dall-e-2256x256, 512x512, 1024x1024standardFaster, cheaper, no prompt rewriting
gpt-image-11024x1024, 1536x1024, 1024x1536, autolow, medium, highTransparent backgrounds, inpainting

Errors

All errors follow the OpenAI structured shape:

{ "error": { "type": "invalid_request_error", "message": "..." } }
Statuserror.typeMeaning
400invalid_request_errorSchema violation or content policy rejection.
401authentication_errorMissing or invalid API key.
402billing_errorAccount out of credit or hit a spend limit.
403permission_errorKey lacks the required scope.
429rate_limit_errorRPM exceeded. Respect Retry-After.
500internal_server_errorUnexpected gateway failure. Safe to retry.
502 / 503upstream_errorDownstream provider failure.