Pixazo APIModelsGLM Image
Pixazo APIModelsGLM Image

GLM Image - AI Image Generation APIs

by Z.ai

GLM Image is a versatile interface that allows developers to integrate advanced image generation and editing capabilities into their applications. By leveraging a specialized model architecture, it can transform natural language prompts into high-quality visuals with a particular focus on accurate text rendering and complex scene composition. The API supports various performance tiers to balance speed and detail, making it suitable for a wide range of use cases from rapid prototyping to final asset creation.

Get API Key
GLM Image API

Models Version

LIMITED TIME OFFER

Get $5 Free Credit on First Payment

No strings attached — add funds and get $5 bonus instantly

Claim Your $5 →

GLM Image v1 Text to Image API Documentation

https://gateway.pixazo.ai/glm-image/v1

Authentication

All requests require an API key passed via header.

Header Type Required Description
Ocp-Apim-Subscription-Key string Yes Your API subscription key

GLM Image generate request - GLM Image

Request Code

POST https://gateway.pixazo.ai/glm-image/v1/glm-image-request
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "prompt": "An elegant watercolor menu card painted on textured cream paper, soft turquoise washes, golden accents, dreamy bokeh background, editorial photography style",
  "image_size": "square_hd",
  "num_inference_steps": 30,
  "guidance_scale": 1.5,
  "num_images": 1,
  "enable_safety_checker": true,
  "output_format": "jpeg"
}
import requests

url = "https://gateway.pixazo.ai/glm-image/v1/glm-image-request"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "prompt": "An elegant watercolor menu card painted on textured cream paper, soft turquoise washes, golden accents, dreamy bokeh background, editorial photography style",
    "image_size": "square_hd",
    "num_inference_steps": 30,
    "guidance_scale": 1.5,
    "num_images": 1,
    "enable_safety_checker": true,
    "output_format": "jpeg"
}

response = requests.post(url, json=data, headers=headers)
print(response.json())
const url = 'https://gateway.pixazo.ai/glm-image/v1/glm-image-request';
const headers = {
  'Content-Type': 'application/json',
  'Cache-Control': 'no-cache',
  'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
};
const data = {
  prompt: 'An elegant watercolor menu card painted on textured cream paper, soft turquoise washes, golden accents, dreamy bokeh background, editorial photography style',
  image_size: 'square_hd',
  num_inference_steps: 30,
  guidance_scale: 1.5,
  num_images: 1,
  enable_safety_checker: true,
  output_format: 'jpeg'
};

fetch(url, {
  method: 'POST',
  headers: headers,
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
curl -X POST "https://gateway.pixazo.ai/glm-image/v1/glm-image-request" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "prompt": "An elegant watercolor menu card painted on textured cream paper, soft turquoise washes, golden accents, dreamy bokeh background, editorial photography style",
    "image_size": "square_hd",
    "num_inference_steps": 30,
    "guidance_scale": 1.5,
    "num_images": 1,
    "enable_safety_checker": true,
    "output_format": "jpeg"
  }'

Output

{
  "images": [
    {
      "file_name": "nano-banana-pro-edit-output.png",
      "content_type": "image/png",
      "url": "[RESPONSE_URL]"
    }
  ],
  "description": ""
}

Request Parameters - GLM Image generate request

Field Type Required Default Description
prompt string Yes Text description for image generation. Must be descriptive for best results.
image_size string or object No square_hd Image dimensions. Allowed string enums: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9, portrait_3_2, landscape_3_2, portrait_hd, landscape_hd. Custom dimensions: object with {"width": 1280, "height": 720}.
num_inference_steps integer No 30 Number of diffusion denoising steps. Higher values improve quality but increase processing time.
guidance_scale float No 1.5 Classifier-free guidance scale. Controls how closely the output follows the prompt. Higher values increase prompt adherence.
seed integer No Random seed for reproducibility. Use the same seed to generate identical outputs.
num_images integer No 1 Number of images to generate in a single request.
enable_safety_checker boolean No true Enable NSFW content filtering. If disabled, potentially unsafe content may be generated.
output_format string No jpeg Output image format. Allowed: jpeg, png.
sync_mode boolean No If true, returns base64-encoded data URI instead of a public URL. If false or omitted, returns a URL.
enable_prompt_expansion boolean No If true, enhances the input prompt using an LLM to generate more detailed and higher-quality results.

Minimum Request

{
  "prompt": "An elegant watercolor menu card painted on textured cream paper, soft turquoise washes, golden accents, dreamy bokeh background, editorial photography style"
}

Full Request (all options)

{
  "prompt": "An elegant watercolor menu card painted on textured cream paper, soft turquoise washes, golden accents, dreamy bokeh background, editorial photography style",
  "image_size": "square_hd",
  "num_inference_steps": 30,
  "guidance_scale": 1.5,
  "seed": 42,
  "num_images": 1,
  "enable_safety_checker": true,
  "output_format": "jpeg",
  "sync_mode": false,
  "enable_prompt_expansion": true
}

Response

{
  "images": [
    {
      "file_name": "nano-banana-pro-edit-output.png",
      "content_type": "image/png",
      "url": "[RESPONSE_URL]"
    }
  ],
  "description": ""
}

Response Fields - GLM Image generate request

Field Type Description
images array Array of generated image objects.
file_name string Name of the generated image file.
content_type string MIME type of the image (e.g., image/png, image/jpeg).
url string Public URL to access the generated image.
description string Empty string placeholder for compatibility.

Request Headers

Header Value
Content-Type application/json
Cache-Control no-cache
Ocp-Apim-Subscription-Key Your API subscription key

Response Handling

Common status codes for GLM Image generate request.

Code Meaning
200 Success
Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
Too Many Requests
500 Internal Server Error

Error Responses

{
  "error": {
    "code": "INVALID_PARAMETER",
    "message": "Invalid image_size value: invalid_size"
  }
}
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Missing or invalid Ocp-Apim-Subscription-Key header"
  }
}
{
  "error": {
    "code": "INSUFFICIENT_FUNDS",
    "message": "Insufficient wallet balance to process request"
  }
}
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded. Retry after 60 seconds."
  }
}
{
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "Internal server error. Please retry later."
  }
}

Status Values

Status Description
QUEUED Request accepted, waiting to be processed
PROCESSING Being processed by the model
COMPLETED Done — output contains the result
FAILED Failed — check error field for details
ERROR System error — request was not processed and not charged

Status Flow

QUEUED → PROCESSING → (COMPLETED / FAILED / ERROR)

Typical Workflow

  1. Submit a request to /glm-image-request to get a request_id
  2. Wait 2–3 seconds, then send a GET request to /v2/requests/status/{request_id}
  3. Repeat polling every 2–3 seconds until status is COMPLETED, FAILED, or ERROR
  4. If COMPLETED, use output.media_url[0] to retrieve the generated image
  5. Implement exponential backoff for ERROR or 500 responses

GLM Image check status - GLM Image

Request Code

POST https://gateway.pixazo.ai/v2/requests/status/glm-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "request_id": "glm-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
import requests

url = "https://gateway.pixazo.ai/v2/requests/status/glm-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
headers = {
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "request_id": "glm-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

response = requests.post(url, json=data, headers=headers)
print(response.json())
const url = 'https://gateway.pixazo.ai/v2/requests/status/glm-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
const headers = {
  'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
};
const data = {
  request_id: 'glm-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
};

fetch(url, {
  method: 'POST',
  headers: headers,
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
curl -X POST "https://gateway.pixazo.ai/v2/requests/status/glm-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "request_id": "glm-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  }'

Output

{
  "images": [
    {
      "file_name": "nano-banana-pro-edit-output.png",
      "content_type": "image/png",
      "url": "[RESPONSE_URL]"
    }
  ],
  "description": ""
}

Request Parameters - GLM Image check status

Field Type Required Default Description
request_id string Yes The unique identifier returned from the initial /glm-image-request call.

Minimum Request

{
  "request_id": "glm-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Full Request

{
  "request_id": "glm-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Response

{
  "images": [
    {
      "file_name": "nano-banana-pro-edit-output.png",
      "content_type": "image/png",
      "url": "[RESPONSE_URL]"
    }
  ],
  "description": ""
}

Response Fields - GLM Image check status

Field Type Description
images array Array of generated image objects.
file_name string Name of the generated image file.
content_type string MIME type of the image (e.g., image/png, image/jpeg).
url string Public URL to access the generated image.
description string Empty string placeholder for compatibility.

Request Headers

Header Value
Ocp-Apim-Subscription-Key Your API subscription key

Response Handling

Common status codes for GLM Image check status.

Code Meaning
200 Success
Bad Request
401 Unauthorized
404 Not Found
Too Many Requests
500 Internal Server Error

Notes & Tips

  • Poll the status endpoint every 2–3 seconds until COMPLETED, FAILED, or ERROR is returned.
  • Implement exponential backoff for retry logic on ERROR or 500 responses.
  • Use detailed, descriptive prompts with specific styles, lighting, and composition cues for optimal results.
  • Set a seed value to reproduce identical outputs for iterative refinement.
  • Use enable_prompt_expansion: true for complex scenes to improve detail and coherence.
  • Prefer output_format: "png" for images requiring transparency or lossless quality.
  • Avoid overly long prompts exceeding 500 characters for best performance.
  • Processing time typically ranges from 5–15 seconds depending on complexity.
  • Multiple images (num_images > 1) may increase processing time proportionally.

GLM Image v1 Text to Image API Pricing

ResolutionPrice (USD)
All Resolution$0.05

GLM Image v1 Image to Image API Documentation

https://gateway.pixazo.ai/glm-image-image-to-image/v1

Authentication

All requests require an API key passed via header.

Header Type Required Description
Ocp-Apim-Subscription-Key string Yes Your API subscription key

GLM Image (Image to Image) generate request - GLM Image (Image to Image)

Request Code

POST https://gateway.pixazo.ai/glm-image-image-to-image/v1/glm-image-image-to-image-request
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "prompt": "Make the dress red.",
  "image_urls": [
    "https://example.com/example_inputs/catwalk.png"
  ]
}
import requests

url = "https://gateway.pixazo.ai/glm-image-image-to-image/v1/glm-image-image-to-image-request"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "prompt": "Make the dress red.",
    "image_urls": [
        "https://example.com/example_inputs/catwalk.png"
    ]
}

response = requests.post(url, json=data, headers=headers)
print(response.json())
const url = "https://gateway.pixazo.ai/glm-image-image-to-image/v1/glm-image-image-to-image-request";
const headers = {
  "Content-Type": "application/json",
  "Cache-Control": "no-cache",
  "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
};
const data = {
  prompt: "Make the dress red.",
  image_urls: [
    "https://example.com/example_inputs/catwalk.png"
  ]
};

fetch(url, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
curl -X POST "https://gateway.pixazo.ai/glm-image-image-to-image/v1/glm-image-image-to-image-request" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "prompt": "Make the dress red.",
    "image_urls": [
      "https://example.com/example_inputs/catwalk.png"
    ]
  }'

Output

{
  "images": [
    {
      "file_name": "nano-banana-pro-edit-output.png",
      "content_type": "image/png",
      "url": "[RESPONSE_URL]"
    }
  ],
  "description": ""
}

Request Parameters - GLM Image (Image to Image) generate request

Field Type Required Default Description
prompt string Yes Text prompt describing the desired image edit or transformation. Must be detailed for best results.
image_urls string[] Yes Array of URLs (up to 4) pointing to condition images used for image-to-image generation. These guide the editing process.
image_size enum or object No square_hd Output image dimensions. Allowed enum values: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9, portrait_3_2, landscape_3_2, portrait_hd, landscape_hd. Custom size: provide object {"width": 1280, "height": 720}.
num_inference_steps integer No 30 Number of diffusion denoising steps. Higher values improve quality but increase processing time.
guidance_scale float No 1.5 Classifier-free guidance scale. Controls how closely the output follows the prompt. Values typically range from 1.0 to 3.0.
seed integer No Random seed for reproducible results. Use the same seed with identical inputs to generate identical outputs.
num_images integer No 1 Number of images to generate in a single request.
enable_safety_checker boolean No true Enable NSFW content filtering. If enabled, outputs containing unsafe content will be blocked or flagged.
output_format enum No jpeg Output image format. Allowed values: jpeg, png.
sync_mode boolean No If true, returns base64-encoded data URI instead of a public URL. Use for low-latency, direct embedding.
enable_prompt_expansion boolean No If true, enhances the input prompt using an LLM to add context, detail, and stylistic cues for improved generation.

Minimum Request

{
  "prompt": "Make the dress red.",
  "image_urls": [
    "https://example.com/example_inputs/catwalk.png"
  ]
}

Full Request (all options)

{
  "prompt": "Make the dress red.",
  "image_urls": [
    "https://example.com/example_inputs/catwalk.png"
  ],
  "image_size": "square_hd",
  "num_inference_steps": 30,
  "guidance_scale": 1.5,
  "seed": 42,
  "num_images": 1,
  "enable_safety_checker": true,
  "output_format": "jpeg",
  "sync_mode": false,
  "enable_prompt_expansion": false
}

Response

{
  "images": [
    {
      "file_name": "nano-banana-pro-edit-output.png",
      "content_type": "image/png",
      "url": "[RESPONSE_URL]"
    }
  ],
  "description": ""
}

Response Fields - GLM Image (Image to Image) generate request

Field Type Description
images array Array of generated images, each with file_name, content_type, and url.
file_name string Name of the generated image file.
content_type string MIME type of the image (e.g., image/png, image/jpeg).
url string URL to download the generated image.
description string Empty string placeholder for compatibility.

Request Headers

Header Value
Content-Type application/json
Cache-Control no-cache
Ocp-Apim-Subscription-Key Your API subscription key

Response Handling

Common status codes for GLM Image (Image to Image) generate request.

Code Meaning
200 Success
Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
Too Many Requests
500 Internal Server Error

Error Responses

400 Validation Error

{
  "error": "Missing required parameter: prompt",
  "code": "VALIDATION_ERROR"
}

404 Not Found

{
  "error": "Operation not found",
  "code": "NOT_FOUND"
}

Status Handling

Polling status values for GLM Image (Image to Image) generate request.

Status Description
QUEUED Request accepted, waiting to be processed
PROCESSING Being processed by the model
COMPLETED Done — output contains the result
FAILED Failed — check error field for details
ERROR System error — request was not processed and not charged

Status Flow

QUEUED → PROCESSING → (COMPLETED or FAILED or ERROR)

Typical Workflow

  1. Submit request to /glm-image-image-to-image-request and receive a request_id.
  2. Poll the status endpoint /glm-image-image-to-image-request-result every 2–3 seconds using the request_id.
  3. Continue polling until response status is COMPLETED, FAILED, or ERROR.
  4. When COMPLETED, extract the image URL from the response and download the result.

GLM Image (Image to Image) check status - GLM Image (Image to Image)

Request Code

POST https://gateway.pixazo.ai/glm-image-image-to-image/v1/glm-image-image-to-image-request-result
Content-Type: application/json
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "request_id": "glm-image-image-to-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
import requests

url = "https://gateway.pixazo.ai/glm-image-image-to-image/v1/glm-image-image-to-image-request-result"
headers = {
    "Content-Type": "application/json",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "request_id": "glm-image-image-to-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

response = requests.post(url, json=data, headers=headers)
print(response.json())
const url = "https://gateway.pixazo.ai/glm-image-image-to-image/v1/glm-image-image-to-image-request-result";
const headers = {
  "Content-Type": "application/json",
  "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
};
const data = {
  request_id: "glm-image-image-to-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
};

fetch(url, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
curl -X POST "https://gateway.pixazo.ai/glm-image-image-to-image/v1/glm-image-image-to-image-request-result" \
  -H "Content-Type: application/json" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "request_id": "glm-image-image-to-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  }'

Output

{
  "images": [
    {
      "file_name": "nano-banana-pro-edit-output.png",
      "content_type": "image/png",
      "url": "[RESPONSE_URL]"
    }
  ],
  "description": ""
}

Request Parameters - GLM Image (Image to Image) check status

Field Type Required Default Description
request_id string Yes The unique identifier returned from the initial request to /glm-image-image-to-image-request.

Minimum Request

{
  "request_id": "glm-image-image-to-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Full Request (all options)

{
  "request_id": "glm-image-image-to-image_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Response

{
  "images": [
    {
      "file_name": "nano-banana-pro-edit-output.png",
      "content_type": "image/png",
      "url": "[RESPONSE_URL]"
    }
  ],
  "description": ""
}

Response Fields - GLM Image (Image to Image) check status

Field Type Description
images array Array of generated images, each with file_name, content_type, and url.
file_name string Name of the generated image file.
content_type string MIME type of the image (e.g., image/png, image/jpeg).
url string URL to download the generated image.
description string Empty string placeholder for compatibility.

Request Headers

Header Value
Content-Type application/json
Ocp-Apim-Subscription-Key Your API subscription key

Response Handling

Common status codes for GLM Image (Image to Image) check status.

Code Meaning
200 Success
Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
Too Many Requests
500 Internal Server Error

Notes & Tips

  • Poll the status endpoint every 2–3 seconds until COMPLETED, FAILED, or ERROR is returned.
  • Implement exponential backoff for retrying failed or timed-out requests.
  • Use detailed, descriptive prompts with specific color, texture, and style references for best results.
  • For multi-image conditioning, ensure all reference images are high-resolution and clearly depict the elements to be preserved.
  • Use enable_prompt_expansion for ambiguous prompts to improve generation quality.
  • Prefer output_format: png for edits requiring transparency or lossless quality.
  • Set a seed value when reproducibility is required across multiple runs.

GLM Image v1 Image to Image API Pricing

No data available

Could not load current pricing