> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vidgo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Z-Image Turbo

> Z-Image Turbo API 支持文生图和单图编辑。

> [!TIP]
>
> 1. 提交后会返回 `task_id`。如果提供了 `callback_url`，当任务状态变为 `finished` 或 `failed` 时，系统会向 `callback_url` 发送 POST 请求。
> 2. 无论是否提供 `callback_url`，都可以通过统一的[查询任务状态](https://docs.vidgo.ai/zh/api-manual/task-management/status.md)接口获取结果。

## 模型

`alibaba/z-image/turbo` 根据文本生成图像，也可编辑单张参考图。

## 输入参数

* `prompt`：必填字符串，1 到 1000 个字符。描述要生成的图像或要做的编辑。
* `image_urls`：可选数组，只包含一个 HTTP(S) 图像 URL。提供此字段即选择图像编辑。
* `size`：文生图必填，图像编辑可选。取值：`1:1`、`4:3`、`3:4`、`16:9`、`9:16`。
* `enable_safety_checker`：可选布尔值。默认 `true`。

## 文生图

```json theme={null}
{
  "model": "alibaba/z-image/turbo",
  "input": {
    "prompt": "A ceramic vase on a wooden table in soft daylight.",
    "size": "1:1",
    "enable_safety_checker": true
  }
}
```

## 图像编辑

```json theme={null}
{
  "model": "alibaba/z-image/turbo",
  "input": {
    "prompt": "Add soft studio lighting to this product photo.",
    "image_urls": ["https://example.com/reference.png"],
    "enable_safety_checker": true
  }
}
```


## OpenAPI

````yaml zh/api-manual/image-series/alibaba-z-image-turbo.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - Z-Image Turbo
  description: 使用 Z-Image Turbo 进行文生图和单图编辑。
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: 生产环境服务器
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Z-Image Turbo
      summary: 提交 Z-Image Turbo 任务
      description: 根据提示词生成图像，或编辑一张参考图。
      operationId: submitZImageTurboTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              text-to-image:
                summary: 文生图
                value:
                  model: alibaba/z-image/turbo
                  input:
                    prompt: A ceramic vase on a wooden table in soft daylight.
                    size: '1:1'
                    enable_safety_checker: true
              image-editing:
                summary: 图像编辑
                value:
                  model: alibaba/z-image/turbo
                  input:
                    prompt: Add soft studio lighting to this product photo.
                    image_urls:
                      - https://example.com/reference.png
                    enable_safety_checker: true
      responses:
        '200':
          description: 任务提交成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: 请求参数无效
        '401':
          description: 未授权
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      additionalProperties: false
      properties:
        model:
          type: string
          enum:
            - alibaba/z-image/turbo
          example: alibaba/z-image/turbo
          description: Z-Image Turbo 模型标识。
        callback_url:
          type: string
          format: uri
          description: 可选的 Webhook 回调 URL。
        input:
          type: object
          required:
            - prompt
          description: |-
            图像生成参数。文生图时 size 必填；通过 image_urls 提供编辑参考图时可选。

            `size`、`image_urls` 至少提供一个。
          anyOf:
            - required:
                - size
            - required:
                - image_urls
          properties:
            prompt:
              type: string
              minLength: 1
              maxLength: 1000
              description: 描述要生成的图像或要做的编辑，1 到 1000 个字符。
              example: A ceramic vase on a wooden table in soft daylight.
            image_urls:
              type: array
              minItems: 1
              maxItems: 1
              items:
                type: string
                format: uri
                description: 使用公开可访问的 HTTP(S) 下载 URL。
              description: 一个用作编辑参考的 HTTP(S) 图像 URL。提供此字段即选择图像编辑。
              example:
                - https://example.com/reference.png
            size:
              type: string
              enum:
                - '1:1'
                - '4:3'
                - '3:4'
                - '16:9'
                - '9:16'
              description: 输出宽高比。文生图必填；图像编辑可选。
              example: '1:1'
            enable_safety_checker:
              type: boolean
              default: true
              description: 开启安全检查。默认 true。
              example: true
          additionalProperties: false
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          example: 200
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
            status:
              type: string
              enum:
                - not_started
                - running
                - failed
            created_time:
              type: string
              format: date-time
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: '使用 `Authorization: Bearer VIDGO_API_KEY`。'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.