---
title: "Generate Image"
method: POST
path: "/paas/v4/images/generations"
---

# Generate Image

`POST /paas/v4/images/generations`

Use [GLM-Image](/guides/image/glm-image) series models to generate high-quality images from text prompts. Through quick and accurate understanding of user text descriptions, `AI` image expression becomes more precise and personalized.

## Request body

- CreateImageRequest
  - `model` 'glm-image' | 'cogview-4-250304', required — Model code
  - `prompt` string, required — The text description of the image to be generated.
  - `quality` 'hd' | 'standard' — The quality of the generated image. `glm-image` default is `hd`, others model is `standard`. `hd`: Generates a more detailed and rich image with higher overall consistency, but takes about `20` seconds. `standard`: Generates an image quickly, suitable for scenarios with higher requirements for generation speed, takes about `5-10` seconds.
  - `size` string — Image size. `glm-image` recommended enum values: `1280x1280` (default), `1568x1056`, `1056x1568`, `1472x1088`, `1088x1472`, `1728x960`, `960x1728`. Custom parameter: Both width and height must be between `1024px-2048px`, and must be divisible by `32`, and the maximum pixel count must not exceed `2^22px`. Others model recommended enum values: `1024x1024` (default), `768x1344`, `864x1152`, `1344x768`, `1152x864`, `1440x720`, `720x1440`. Custom parameter: Both width and height must be between `512px-2048px`, and must be divisible by `16`, and the maximum pixel count must not exceed `2^21px`.
  - `user_id` string — Unique ID of the end user, helping the platform intervene in illegal activities, inappropriate content generation, or other abuses. ID length: 6 to 128 characters.

## Response `200`

Processing successful

- ImageGenerationResponse
  - `created` integer — Request creation time, in `Unix` timestamp format, unit is seconds.
  - `data` object[] — Array, containing the generated image `URL`. Currently, the array only contains one image.
    - `url` string, required — Image link. The temporary link expires after `30` days, please store it promptly.
  - `content_filter` object[] — Array, containing content safety related information.
    - `role` 'assistant' | 'user' | 'history' — Safety enforcement stage, including `role = assistant` model inference, `role = user` user input, `role = history` historical context.
    - `level` integer — Severity level `level 0-3`, `level 0` is most severe, `3` is least severe.

## Other responses

- `default` — Request Failed

---

[API](https://skmtc.net/z/apis/z-ai-api.md) · [All operations](https://skmtc.net/z/apis/z-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/z/z-ai-api/revisions/242a797fa80b/schema)
