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-1.5",
    "prompt": "A panda eating bamboo",
    "n": 1,
    "size": "1024x1024"
  }'

Response

{
    "created": 1771066765,
    "background": null,
    "data": [
        {
            "b64_json": "iVBORw0KGgoAAAA....",
            "revised_prompt": null,
            "url": null
        }
    ],
    "output_format": "png",
    "quality": "high",
    "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