图像生成
Z.ai Image
智谱 Z.ai 图像生成 — 轻量快速,中英双语 Prompt,低延迟低成本
POST
/
v1
/
tasks
Z.ai Image
curl --request POST \
--url https://www.qingbo.dev/v1/tasks \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"action": "<string>",
"prompt": "<string>",
"n": 123,
"aspect_ratio": "<string>",
"resolution": "<string>",
"callback_url": "<string>",
"callback_events": [
"<string>"
],
"prompt_extend": true
}
'import requests
url = "https://www.qingbo.dev/v1/tasks"
payload = {
"model": "<string>",
"action": "<string>",
"prompt": "<string>",
"n": 123,
"aspect_ratio": "<string>",
"resolution": "<string>",
"callback_url": "<string>",
"callback_events": ["<string>"],
"prompt_extend": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
action: '<string>',
prompt: '<string>',
n: 123,
aspect_ratio: '<string>',
resolution: '<string>',
callback_url: '<string>',
callback_events: ['<string>'],
prompt_extend: true
})
};
fetch('https://www.qingbo.dev/v1/tasks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.qingbo.dev/v1/tasks"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"n\": 123,\n \"aspect_ratio\": \"<string>\",\n \"resolution\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"callback_events\": [\n \"<string>\"\n ],\n \"prompt_extend\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.qingbo.dev/v1/tasks")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"n\": 123,\n \"aspect_ratio\": \"<string>\",\n \"resolution\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"callback_events\": [\n \"<string>\"\n ],\n \"prompt_extend\": true\n}")
.asString();{
"task_id": "task-wave1775285160b950328499",
"model": "z-image-turbo",
"action": "generate",
"status": "queued",
"created_at": 1775285160040,
"progress": 0
}
智谱 Z.ai 推出的轻量快速图像生成模型,中英双语 Prompt 均良好支持,延迟低、单价低,适合批量草图、运营素材、快速预览等高频场景。
按张计费,纯文生图(不接受参考图),固定单次返回 1 张。
提交后用
定价
| 模型 | 单价(每张) |
|---|---|
z-image-turbo | $0.01125 |
调用示例
curl -X POST https://www.qingbo.dev/v1/tasks \
-H "Authorization: Bearer $WAVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "z-image-turbo",
"prompt": "夕阳下的海边咖啡馆,木质露台,暖色调",
"aspect_ratio": "16:9",
"resolution": "1K"
}'
curl -X POST https://www.qingbo.dev/v1/tasks \
-H "Authorization: Bearer $WAVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "z-image-turbo",
"prompt": "一只柴犬",
"prompt_extend": true,
"aspect_ratio": "1:1",
"resolution": "2K"
}'
{
"task_id": "task-wave1775285160b950328499",
"model": "z-image-turbo",
"action": "generate",
"status": "queued",
"created_at": 1775285160040,
"progress": 0
}
GET /v1/tasks/{task_id} 轮询状态,详见 任务系统。
可用模型
| 模型 ID | 说明 |
|---|---|
z-image-turbo | 轻量快速,中英双语,1K/2K,纯文生(无参考图) |
通用参数
string
默认值:"generate"
操作类型,
z-image-turbo 仅支持 generate(文生图)string
必填
图像描述文本,中英文均良好支持。最长 800 字符
integer
默认值:"1"
生成数量。该模型固定单次返回 1 张,不支持
n > 1string
默认值:"1:1"
画面宽高比,可选值:
1:1— 正方形4:3/3:4— 横/竖版标准16:9/9:16— 横/竖版宽屏3:2/2:3— 横/竖版相机比
string
默认值:"1K"
输出分辨率,可选
1K / 2K模型特定参数
boolean
默认值:"false"
智能改写提示词。开启后 AI 自动优化提示词,效果更好但费用增加
注意事项
- 单次只能 1 张 —
n字段固定为 1,如需多张请多次提交任务 - Prompt 上限 800 字符 — 超长 Prompt 请自行裁剪
prompt_extend开启后费用上升 — AI 改写会消耗额外推理成本,批量场景请按需开启- 纯文生图 — 不接受
image_urls参考图,如需图生图请选择其他模型
资源限制
| 项目 | 限制 |
|---|---|
| 单次生成数量 | 固定 1 张 |
| Prompt 长度 | ≤ 800 字符 |
| 输出分辨率 | 1K / 2K |
| 输出文件 | JPG,链接 24 小时有效 |
相关文档
⌘I
Z.ai Image
curl --request POST \
--url https://www.qingbo.dev/v1/tasks \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"action": "<string>",
"prompt": "<string>",
"n": 123,
"aspect_ratio": "<string>",
"resolution": "<string>",
"callback_url": "<string>",
"callback_events": [
"<string>"
],
"prompt_extend": true
}
'import requests
url = "https://www.qingbo.dev/v1/tasks"
payload = {
"model": "<string>",
"action": "<string>",
"prompt": "<string>",
"n": 123,
"aspect_ratio": "<string>",
"resolution": "<string>",
"callback_url": "<string>",
"callback_events": ["<string>"],
"prompt_extend": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
action: '<string>',
prompt: '<string>',
n: 123,
aspect_ratio: '<string>',
resolution: '<string>',
callback_url: '<string>',
callback_events: ['<string>'],
prompt_extend: true
})
};
fetch('https://www.qingbo.dev/v1/tasks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.qingbo.dev/v1/tasks"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"n\": 123,\n \"aspect_ratio\": \"<string>\",\n \"resolution\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"callback_events\": [\n \"<string>\"\n ],\n \"prompt_extend\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.qingbo.dev/v1/tasks")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"action\": \"<string>\",\n \"prompt\": \"<string>\",\n \"n\": 123,\n \"aspect_ratio\": \"<string>\",\n \"resolution\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"callback_events\": [\n \"<string>\"\n ],\n \"prompt_extend\": true\n}")
.asString();{
"task_id": "task-wave1775285160b950328499",
"model": "z-image-turbo",
"action": "generate",
"status": "queued",
"created_at": 1775285160040,
"progress": 0
}