文档

Z-Image-Turbo 图像生成

- 异步处理模式,返回任务ID用于后续查询

  • 异步处理模式,返回任务ID用于后续查询
  • 轻量快速图片生成,支持中英双语
  • 支持 1K/2K 分辨率档位,支持智能改写提示词

请求示例

bash curl --request POST \ --url https://api.openveer.com/v1/images/generations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "z-image-turbo", "prompt": "水墨画风格的山水风景" }'

```python
import requests

url = "https://api.openveer.com/v1/images/generations"

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

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

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

print(response.json())
```

```javascript
const url = "https://api.openveer.com/v1/images/generations";

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

const headers = {
Authorization: "Bearer ",
"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));
```

响应示例

json { "code": 200, "data": [ { "status": "submitted", "task_id": "task_01JGXYZ1234567890ABCDEF" } ] }

json { "error": { "code": 400, "message": "请求参数无效", "type": "invalid_request_error" } }

json { "error": { "code": 401, "message": "身份验证失败,请检查您的API密钥", "type": "authentication_error" } }

json { "error": { "code": 402, "message": "账户余额不足,请充值后再试", "type": "payment_required" } }

支持的模型

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

Authorizations

Authorization string
所有接口均需要使用Bearer Token进行认证 获取 API Key: 访问 [API Key 管理页面](https://openveer.com) 获取您的 API Key 使用时在请求头中添加: ``` Authorization: Bearer YOUR_API_KEY ```

Body

model string
模型名称 * `z-image-turbo` - 轻量快速图片生成,支持中英双语
prompt string
图像生成的文本描述,最多 800 字符
size string
图像宽高比 支持的宽高比: * `1:1` - 正方形(默认) * `4:3` - 横向 4:3 * `3:4` - 纵向 3:4 * `16:9` - 横向宽屏 * `9:16` - 纵向竖屏 * `3:2` - 横向 3:2 * `2:3` - 纵向 2:3
resolution string
分辨率档位 * `1K` - 标准分辨率(默认) * `2K` - 高清分辨率
prompt_extend boolean
智能改写提示词 开启后,AI 会自动优化提示词,生成效果更好,费用会有所增加。 * `false` - 关闭(默认) * `true` - 开启

尺寸对照表

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

比例 1K 档位 2K 档位
1:1 1024×1024 2048×2048
4:3 1152×864 2048×1536
3:4 864×1152 1536×2048
16:9 1280×720 2048×1152
9:16 720×1280 1152×2048
3:2 1248×832 2048×1360
2:3 832×1248 1360×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
返回数据数组 任务状态 * `submitted` - 已提交
task_id string
任务唯一标识符

注意事项

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