Skip to main content

Request

curl --location 'https://api.znapai.com/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $ZnapAI_API_KEY' \
--data '{
    "model": "gpt-image-2",
    "prompt": "Japanese negative film aesthetic, rooftop summer scene, soft natural sunlight, slight overexposure highlights, low contrast, muted faded colors, subtle grain  subject standing or sitting on rooftop edge area, body relaxed, slight wind moving hair and clothes, looking toward camera with calm distant gaze, not posing  open sky, empty space, minimal elements, imperfect composition, quiet isolated mood, nostalgic and reflective, “memory-like realism” --2:3",
    "n": 1,
    "size": "1024x1024",
    "quality": "low"
  }'

Response

{
    "created": 1771066765,
    "background": null,
    "data": [
        {
            "b64_json": "iVBORw0KGgoAAAA....",
            "revised_prompt": null,
            "url": null
        }
    ],
    "output_format": "png",
    "quality": "low",
    "size": "1024x1024",
    "usage": {
        "total_tokens": 4576,
        "input_tokens": 10,
        "input_tokens_details": {
            "image_tokens": 0,
            "text_tokens": 10
        },
        "output_tokens": 4566,
        "output_tokens_details": {
            "image_tokens": 4160,
            "text_tokens": 406
        }
    }
}

Image from base64 data

Screenshot 2026 01 12 At 5 57 44 PM

Image generation with additional parameters for supported gemini models

Request

curl --location 'https://api.znapai.com/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $ZnapAI_API_KEY' \
--data '{
    "model": "gemini-3-pro-image",
    "prompt": "A panda eating bamboo",
    "imageConfig": {
      "aspectRatio": "16:9",
      "imageSize": "1K"
    }
  }'

Response

Gemini3 Image

Parameters

model
string
required
Name of the model to use (for example: gpt-image-2). To see the complete list of supported image generation models, visit: https://znapai.com/models/image_generation
prompt
string
required
A text description of the desired image(s). The maximum length is 32,000 characters for the GPT image models, 1,000 characters for dall-e-2 and 4,000 characters for dall-e-3.
n
integer
default:1
The number of images to generate. Must be between 1 and 10.
size
string
default:"1024x1024"
Output image dimensions. Supports arbitrary WIDTHxHEIGHT where both edges are multiples of 16, aspect ratio between 1:3 and 3:1, max edge 3840.Standard values: 1024x1024, 1536x1024, 1024x1536, auto.Supported values depend on the selected model. See the OpenAI image generation guide for the latest model-specific ranges.
quality
string
default:"auto"
Image quality level. Higher quality increases cost and latency.Allowed values: low, medium, high, auto
background
string
default:"auto"
Background behavior for the generated image.Allowed values: opaque, auto
transparent is not supported on gpt-image-2.
output_compression
integer
Compression level (0–100). Only applies when output_format is jpeg.
stream
boolean
default:false
Stream partial images as they are generated. Use with --no-buffer in curl.
partial_images
integer
Number of partial images to emit during streaming. Value between 0 and 3. Only used when stream is true.
moderation
string
default:"auto"
Content moderation strictness.Allowed values: auto, low
imageConfig
object
Optional configuration parameters for supported Gemini image models.

Params to Avoid

ParamReason
response_format: "url"ZnapAI image endpoint only returns b64_json
background: "transparent"Not supported by OpenAI/Gemini image generation models
output_format: "webp"WebP output format is not supported
styleVivid or natural style configurations are DALL-E 3 exclusive and not supported