Z-Image AI Model API documentation
Generate images with Z-Image AI Model (Alibaba Tongyi).
Endpoints
| Contract item | Value |
|---|---|
| Capability | z-image-ai-model |
| Submit | POST https://vidmage.ai/api/v1/z-image-ai-model/submit |
| Query | POST https://vidmage.ai/api/v1/z-image-ai-model/query |
| Task identifier | taskId |
| Result field | imageUrl |
Authenticate with Authorization: Bearer YOUR_API_KEY. Save the task identifier and query the same capability. Use a stable Idempotency-Key for submission retries.
Product guide: Z-Image API
Parameters and input rules
| Field | Type | Required | Default | Meaning and limits |
|---|---|---|---|---|
prompt | string | Yes | Not specified | Text prompt describing the image to generate (max 2500 chars). For an unspecified character or figurine, use an original non-branded character with no logos and no resemblance to existing copyrighted superheroes; preserve any character the user explicitly names. Minimum characters: 1Maximum characters: 2500 |
aspectRatio | string | No | "1:1" | Output aspect ratio. Values: "1:1", "3:4", "4:3", "9:16", "16:9", "2:3", "3:2" |
outputFormat | string | No | "png" | Output image file format. Values: "png", "jpeg", "webp-lossless", "webp-lossy" |
text to image
These are public VidMage field names. The server maps them to provider fields. Input media selects the mode; use its limits together with the parameter table.
| Control | Mode-specific rule |
|---|---|
prompt | Required; 1–2500 characters. |
aspectRatio | Values: "1:1", "3:4", "4:3", "9:16", "16:9", "2:3", "3:2". Default: 1:1. |
resolution | Not used in this mode. |
outputFormat | Output image file format. Values: "png", "jpeg", "webp-lossless", "webp-lossy"Default: "png" |
Example request
{
"prompt": "Architectural visualization of a compact lakeside cabin with timber walls and large windows at twilight",
"aspectRatio": "1:1",
"outputFormat": "png"
}# Set VIDMAGE_IDEMPOTENCY_KEY to a unique value for this task; preserve it for transport retries.
curl -X POST "https://vidmage.ai/api/v1/z-image-ai-model/submit" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: ${VIDMAGE_IDEMPOTENCY_KEY}" \
-H "Content-Type: application/json" \
-d '{"prompt":"Architectural visualization of a compact lakeside cabin with timber walls and large windows at twilight","aspectRatio":"1:1","outputFormat":"png"}'
# -> { "success": true, "taskId": "...", "creditsConsumed": ... }Task results and recovery
URL of the generated image. Read imageUrl from the completed query response. Preserve taskId while the task is running.
curl -X POST "https://vidmage.ai/api/v1/z-image-ai-model/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "taskId": "TASK_ID_FROM_SUBMIT" }'
# -> { "success": true, "data": { "status": "...", "imageUrl": "https://..." } }Submission and task queries report the available task and usage information. A timeout is not a confirmed failure. Recover the existing task instead of resubmitting.
For face selection and error recovery, follow Task lifecycle. MCP uses the normalized taskId argument in get_task_result, including capabilities whose REST identifier is requestId.
Credits
| Component / option | Rate | Minimum |
|---|---|---|
| Base rate | 5 credits / generation | — |
Base charge is per generation at the selected resolution.
Use the Playground or the MCP credit estimator for your exact inputs. Credits and billing.
