Skip to main content
POST
/
paas
/
v4
/
async
/
images
/
generations
Generate Image (Async)
curl --request POST \
  --url https://api.z.ai/api/paas/v4/async/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "glm-image",
  "prompt": "A cute little kitten sitting on a sunny windowsill, with the background of blue sky and white clouds.",
  "size": "1280x1280"
}
'
{
  "model": "<string>",
  "id": "<string>",
  "request_id": "<string>",
  "task_status": "<string>"
}

Authorizations

Authorization
string
header
required

Use the following format for authentication: Bearer

Body

application/json
model
enum<string>
required

Model code

Available options:
glm-image
Example:

"glm-image"

prompt
string
required

The text description of the image to be generated.

Example:

"A cute little kitten."

quality
enum<string>
default:hd

The quality of the generated image. hd: Generates a more detailed and rich image with higher overall consistency, takes about 20 seconds.

Available options:
hd
size
string
default:1280x1280

Image size, 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.

Example:

"1280x1280"

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.

Required string length: 6 - 128

Response

Processing successful

model
string

Model name used in this call.

id
string

Task order number generated by the platform, use this order number when calling the async result interface.

request_id
string

Task number submitted by the user during the client request or generated by the platform.

task_status
string

Processing status, PROCESSING (processing), SUCCESS (success), FAIL (failure). Results need to be obtained via query.