Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.znapai.com/llms.txt

Use this file to discover all available pages before exploring further.


Request

curl --location 'https://api.znapai.com/azure/openai/deployments/gpt-image-2/images/generations?api-version=2024-02-01' \
--header 'Authorization: Bearer $ZnapAI_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "prompt": "A professional product photo of a white desk lamp on a neutral studio background, soft lighting, 50mm lens feel",
    "size": "1536x1024",
    "quality": "low",
    "n": 1,
    "output_format": "jpeg",
    "output_compression": 85,
    "background": "opaque",
    "moderation": "auto"
  }'

Response

{
    "created": 1778262087,
    "background": "opaque",
    "data": [
        {
            "b64_json": "/9j/4AAQSkZJRgABAQAAAQABAAD/60otSlACEQAAAAEAAEojanVtYgAAAB5qdW1kYzJwYQARABCAAACqADibcQNjMnBhAAAASf1qdW1iAAAAR2p1bWRjMm1hABEAEIAAAKoAOJtxA3VybjpjMnBhOjQzYjU5ZDJhLTMxMDEtNDcyOS1hMGU3LTkyMjBhODMyMmUxMQAAAAQWanVtYgAAAClqdW1kYzJhcwARABCAAACqgA0li0gADKgAErYCRQCQAZUbVlQAPF3gSAAlQCVJFAUkGJWgFAAkCQMGsAABIAJUKBIoBzqKSDCLQAAH/2Q=="
        }
    ],
    "output_format": "jpeg",
    "quality": "low",
    "size": "1536x1024",
    "usage": {
        "input_tokens": 29,
        "input_tokens_details": {
            "image_tokens": 0,
            "text_tokens": 29
        },
        "output_tokens": 158,
        "total_tokens": 187
    }
}

Image from base64 data

Azure Image

Parameters

prompt
string
required
Text description of the desired image. Maximum 32,000 characters.
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
quality
string
default:"auto"
Image quality level. Higher quality increases cost and latency.Allowed values: low, medium, high, auto
n
integer
default:"1"
Number of images to generate. Must be between 1 and 10.
output_format
string
default:"png"
Format of the returned image.Allowed values: png, jpeg
webp is not supported on Azure gpt-image-2.
output_compression
integer
Compression level (0–100). Only applies when output_format is jpeg.
background
string
default:"auto"
Background behavior for the generated image.Allowed values: opaque, auto
transparent is not supported on Azure gpt-image-2.
moderation
string
default:"auto"
Content moderation strictness.Allowed values: auto, low
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.

Params to Never Send

ParamReason
response_format: "url"Returns empty response from Azure
background: "transparent"Not supported on Azure gpt-image-2
output_format: "webp"Not supported on Azure gpt-image-2
style: "vivid"dall-e-3 only
The generation endpoint only returns b64_json. Requesting a URL response format is not supported and returns an empty response.