TokenFlashTokenFlash
Api referenceImagesZ image turbo

Z-Image-Turbo 图像生成

  • 异步处理模式,返回任务ID用于后续查询
  • 轻量快速图片生成,支持中英双语
  • 支持 1K/2K 分辨率档位,支持智能改写提示词
curl --request POST \
  --url https://tokenflash.cn/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "z-image-turbo",
    "prompt": "水墨画风格的山水风景"
  }'
import requests

url = "https://tokenflash.cn/v1/images/generations"

payload = {
    "model": "z-image-turbo",
    "prompt": "水墨画风格的山水风景"
}

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
const url = "https://tokenflash.cn/v1/images/generations";

const payload = {
  model: "z-image-turbo",
  prompt: "水墨画风格的山水风景",
};

const headers = {
  Authorization: "Bearer <token>",
  "Content-Type": "application/json",
};

fetch(url, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(payload),
})
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01JGXYZ1234567890ABCDEF"
    }
  ]
}
{
  "error": {
    "code": 400,
    "message": "请求参数无效",
    "type": "invalid_request_error"
  }
}
{
  "error": {
    "code": 401,
    "message": "身份验证失败,请检查您的API密钥",
    "type": "authentication_error"
  }
}
{
  "error": {
    "code": 402,
    "message": "账户余额不足,请充值后再试",
    "type": "payment_required"
  }
}

支持的模型

模型名说明生成张数计费方式
z-image-turbo轻量快速图片生成,支持中英双语固定 1 张固定价格

Authorizations

string required

所有接口均需要使用Bearer Token进行认证

获取 API Key:

访问 API Key 管理页面 获取您的 API Key

使用时在请求头中添加:

Authorization: Bearer YOUR_API_KEY

Body

string required

模型名称

  • z-image-turbo - 轻量快速图片生成,支持中英双语
string required

图像生成的文本描述,最多 800 字符

string

图像宽高比

支持的宽高比:

  • 1:1 - 正方形(默认)
  • 4:3 - 横向 4:3
  • 3:4 - 纵向 3:4
  • 16:9 - 横向宽屏
  • 9:16 - 纵向竖屏
  • 3:2 - 横向 3:2
  • 2:3 - 纵向 2:3
string

分辨率档位

  • 1K - 标准分辨率(默认)
  • 2K - 高清分辨率
boolean

智能改写提示词

开启后,AI 会自动优化提示词,生成效果更好,费用会有所增加。

  • false - 关闭(默认)
  • true - 开启

尺寸对照表

通过 size(比例)+ resolution(分辨率档位)组合控制输出尺寸。

比例1K 档位2K 档位
1:11024×10242048×2048
4:31152×8642048×1536
3:4864×11521536×2048
16:91280×7202048×1152
9:16720×12801152×2048
3:21248×8322048×1360
2:3832×12481360×2048

使用场景示例

基础文生图(最简请求)

{
  "model": "z-image-turbo",
  "prompt": "水墨画风格的山水风景"
}

指定比例和分辨率

{
  "model": "z-image-turbo",
  "prompt": "极简主义风格的咖啡厅室内设计",
  "size": "16:9",
  "resolution": "2K"
}

开启智能改写

{
  "model": "z-image-turbo",
  "prompt": "一只猫",
  "prompt_extend": true
}

Response

code integer

响应状态码

data array

返回数据数组

注意事项

  1. 异步处理:提交后返回 task_id,需轮询 /v1/tasks/{task_id} 获取结果
  2. 图片存储:生成的图片已镜像到平台 CDN,长期有效
  3. 计费规则:按成功生成的图片张数计费,失败不扣费
  4. 固定张数:Z-Image-Turbo 固定每次生成 1 张,不支持 n 参数

On this page