AIAPIAIAPI API

Z-Image Spicy

Model ID alibaba/z-image-spicy

Overview

Text-to-image generation with custom dimensions, reproducible seeds, and optional intelligent prompt rewriting.

Alibaba · text-to-image

Important: The size field and width/height fields are mutually exclusive. Do not mix them in one request.

Endpoint

POST /v1/images/generations/async

Authentication

Authorization: Bearer <AIAPIAIAPI_API_KEY>

Request Body

ParameterTypeRequiredNullableDefaultConstraintsDescription
modelstringYesNo-values: alibaba/z-image-spicyModel ID used to route the request.
promptstringYesNo--Text prompt describing the image to generate.
sizestringNoNo--Optional output dimensions in WIDTHxHEIGHT format. Cannot be combined with width or height; each dimension must be 256-1536 pixels.
widthintegerNoNo`1024`range: 256-1536Output image width in pixels. Cannot be combined with size.
heightintegerNoNo`1536`range: 256-1536Output image height in pixels. Cannot be combined with size.
seedintegerNoNo-min: 0Random seed. Omit it or use 0 for random generation; use a positive integer for reproducible output.
prompt_extendbooleanNoNo`true`-Enable intelligent prompt rewriting. Enabled by default and billed separately when used.
output_formatstringNoNo`png`values: pngGenerated image file format. Z-Image Spicy currently supports PNG only.
nintegerNoNo`1`values: 1Number of images generated by one task. Z-Image Spicy supports exactly one image.

model

Type: string · Required: Yes · Nullable: No

Model ID used to route the request.

prompt

Type: string · Required: Yes · Nullable: No

Text prompt describing the image to generate.

size

Type: string · Required: No · Nullable: No

Optional output dimensions in WIDTHxHEIGHT format. Cannot be combined with width or height; each dimension must be 256-1536 pixels.

width

Type: integer · Required: No · Nullable: No

Output image width in pixels. Cannot be combined with size.

height

Type: integer · Required: No · Nullable: No

Output image height in pixels. Cannot be combined with size.

seed

Type: integer · Required: No · Nullable: No

Random seed. Omit it or use 0 for random generation; use a positive integer for reproducible output.

prompt_extend

Type: boolean · Required: No · Nullable: No

Enable intelligent prompt rewriting. Enabled by default and billed separately when used.

output_format

Type: string · Required: No · Nullable: No

Generated image file format. Z-Image Spicy currently supports PNG only.

n

Type: integer · Required: No · Nullable: No

Number of images generated by one task. Z-Image Spicy supports exactly one image.

Request Example

curl --request POST \
  --url https://aiapiaiapi.com/v1/images/generations/async \
  --header 'Authorization: Bearer $AIAPIAIAPI_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
      "model": "alibaba/z-image-spicy",
      "prompt": "A cinematic camera movement through a forest",
      "width": 1024,
      "height": 1536,
      "prompt_extend": true
    }'

JSON

{
  "model": "alibaba/z-image-spicy",
  "prompt": "A cinematic camera movement through a forest",
  "width": 1024,
  "height": 1536,
  "prompt_extend": true
}

Response

{
  "code": "success",
  "message": "",
  "data": { "task_id": "image_01K2ABC123" }
}

Task Status

Use the task_id from the create response:

GET /v1/images/generations/async/{task_id}

{
  "code": "success",
  "message": "",
  "data": {
    "task_id": "image_01K2ABC123",
    "status": "SUCCESS",
    "progress": "100%",
    "outputs": ["https://cdn.example.com/images/image_01K2ABC123.png"],
    "start_time": 1786960805,
    "finish_time": 1786960900,
    "submit_time": 1786960800,
    "fail_reason": ""
  }
}

Error Responses

Validation errors return HTTP 400 with a stable error code.

{
  "code": "unsupported_parameter",
  "message": "The parameter is not supported by this model.",
  "data": null
}

Documentation Index

Fetch the complete documentation index at:

https://aiapiaiapi.com/llms.txt

Use this file to discover all available API documentation.