教程
Qwen Image 2.0 与 2.0 Pro API:价格、真实输出与代码示例
一篇指南涵盖 Qwen Image 2.0 两个档位:中英双语文本测试、产品图、固定尺寸取值,以及 2.0 与 2.1、3.0 的对比。
摘要
- Qwen Image 2.0 是阿里巴巴的文生图模型,擅长在图片中生成中文和英文文本。在 HiAPI 上提供两个档位:
qwen-image-2.0每张 $0.0422,qwen-image-2.0-pro每张 $0.107。 - 两者接受相同的请求:
prompt加上五个固定size取值之一。没有aspect_ratio字段,也不接受图像输入。 - 如果你要启动新项目,请优先考虑更新版本:Qwen Image 3.0 每张 $0.0358,2.1 Turbo 每张 $0.02,都比 2.0 便宜,而且都支持参考图像。对比见文末。打开 Qwen Image 2.0 Pro 模型页即可试用;新账户赠送 200 点免费额度。
2.0 还是 2.0 Pro
qwen-image-2.0 |
qwen-image-2.0-pro |
|
|---|---|---|
| 每张图像价格 | $0.0422 | $0.107 |
| 输入 | prompt + size |
相同 |
| 尺寸 | 5 个固定取值,最大 2688×1536 | 相同 |
| 参考图像 | 不支持 | 不支持 |
| 适用场景 | 草稿、双语海报、标识 | 最终产品图和横幅 |
HiAPI 实时价格,查询于 2026 年 10 月 20 日。失败的任务不计费。
请求完全相同,所以切换档位只需更改 model 中的一个词。在 2.0 上编写并测试提示词,然后用相同的 seed 在 Pro 上渲染最终版本。
真实输出
双语招牌(2.0)
A small Tokyo-style ramen shop at night, photoreal, soft drizzle on the pavement, warm interior light spilling out, customers visible through a frosted window. Above the door, a hand-painted wooden sign with two clean lines of text: the top line in large Chinese characters reads "幸福拉面", the bottom line in smaller English reads "Lucky Noodles · Since 2019". A small red paper lantern hangs to the left. 35mm street photography, shallow depth of field, cinematic colour grade.

qwen-image-2.0,size 1728*2368,按今日价格 $0.0422。
招牌上的两行文字都与提示词一致,包括中间的点。灯笼上没有在提示词中指定任何文字,却出现了几个杂散字符。发布带文字的图像前,请检查每一处小表面。
含三个文本块的海报(2.0)
A modern minimalist promotional poster for a specialty coffee shop, cream background with a subtle paper grain. Centred composition: Top half: a large flat-illustration espresso cup with steam, terracotta-and-cream palette. Middle: large bilingual headline. Chinese line on top reads "夏日新品", English line directly below reads "SUMMER MENU 2026". Both lines are perfectly centred. Lower third: a short body line in smaller Chinese reads "全场买二赠一", and an English line beneath reads "Buy two, get one free". Bottom footer: a single small line of English reads "Through August 31". Clean geometric sans-serif typography, generous whitespace, magazine-quality layout.

qwen-image-2.0,size 1728*2368,按今日价格 $0.0422。
五个字符串全部呈现且拼写正确。标题“SUMMER MENU 2026”被分成两行,而提示词并未要求这样做。
产品主图(2.0 Pro)
Studio product photograph of a single amber glass skincare dropper bottle with a blank matte white label, standing centered on a round travertine stone pedestal, seamless warm off-white studio background, soft diffused key light from the upper left, a subtle soft shadow falling to the right, hyper-detailed macro texture on the glass and brushed-metal dropper cap, photorealistic, catalog-ready e-commerce hero shot, no text, no logos, no props

qwen-image-2.0-pro,size 2048*2048,$0.107。
让产品标签保持空白,之后再添加标签文字。小曲面上的小字号是任何模型最难正确处理字母的地方,而且空白标签在文案变更时更容易更新。
促销横幅(2.0 Pro)
Flat-lay e-commerce promo banner photograph: three amber glass skincare dropper bottles arranged diagonally on a warm terracotta backdrop with dried eucalyptus sprigs, soft overhead studio lighting with gentle shadows, in the upper right corner bold clean white sans-serif text reading SUMMER GLOW SALE, directly beneath it smaller white text reading SAVE 20% TODAY, no other text anywhere, photorealistic commercial photography, sharp focus

qwen-image-2.0-pro,size 2688*1536,$0.107。
文案及其位置与提示词一致。这一张结果底部边缘出现了一条细黑边,因此发布横幅前请计划好裁剪。
curl
curl -s -X POST https://api.hiapi.ai/v1/tasks \
-H "Authorization: Bearer $HIAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-2.0-pro",
"input": {
"prompt": "A storefront window sign that reads \"GRAND OPENING\" in bold red letters, photorealistic, golden-hour light",
"size": "2688*1536",
"seed": 42
}
}'
你会收到一个 taskId。轮询 GET https://api.hiapi.ai/v1/tasks/{taskId},直到 data.status 为 success,然后下载 data.output[0].url。链接在任务完成后约 7 天过期,所以请保存文件。
Python:一个提示词,两个档位
# pip install requests; export HIAPI_KEY=your-key first
import os, time, requests
API = "https://api.hiapi.ai/v1/tasks"
H = {"Authorization": f"Bearer {os.environ['HIAPI_KEY']}"}
def generate(model, timeout_s=300, **inp):
r = requests.post(API, json={"model": model, "input": inp}, headers=H, timeout=30).json()
if r.get("code") != 200:
raise RuntimeError(r) # a 400 names every invalid field
task_id = r["data"]["taskId"]
deadline = time.time() + timeout_s
while time.time() < deadline:
d = requests.get(f"{API}/{task_id}", headers=H, timeout=30).json()["data"]
if d["status"] == "success":
return d["output"][0]["url"]
if d["status"] == "fail":
raise RuntimeError(d.get("error"))
time.sleep(4)
raise TimeoutError(task_id)
prompt = 'A bakery chalkboard that reads "FRESH BREAD" in white chalk, morning light'
draft = generate("qwen-image-2.0", prompt=prompt, size="2048*2048", seed=7)
final = generate("qwen-image-2.0-pro", prompt=prompt, size="2048*2048", seed=7)
for name, url in [("draft.png", draft), ("final.png", final)]:
with open(name, "wb") as f:
f.write(requests.get(url, timeout=120).content)
参数
| 字段 | 是否必填 | 取值 | 说明 |
|---|---|---|---|
prompt |
是 | 文本 | 用引号括起你想要的确切文字 |
size |
否 | 2688*1536、2368*1728、2048*2048(默认)、1728*2368、1536*2688 |
使用 *,不是 x |
negative_prompt |
否 | 文本 | 要避免的内容 |
seed |
否 | 0–2147483647 | 相同的 seed 和提示词可在不同档位间提供稳定的起点 |
prompt_extend |
否 | true(默认)/ false |
当措辞必须保持完全不变时请关闭 |
watermark |
否 | false(默认)/ true |
五个尺寸大致对应 16:9、4:3、1:1、3:4 和 9:16。如需 21:9 或 4:5,请渲染最接近的尺寸再裁剪。
你会遇到的错误
以下所有情况在提交时都会返回 HTTP 400,因此不会创建任务,也不会计费:
size: value must be one of '2688*1536', ...:你发送了2048x2048或自定义尺寸。请使用五个取值之一,并用*分隔。additional properties 'aspect_ratio' not allowed:2.0 使用size。Qwen Image 3.0 和 2.1 改用aspect_ratio。additional properties 'image_urls' not allowed:2.0 无法接受参考图像。编辑请使用 2.1 或 3.0。additional properties 'n' not allowed:一个任务生成一张图像。请并行提交多个任务。
Qwen Image 2.0、2.1 还是 3.0
| 模型 | 每张图像价格 | 参考图像 | 尺寸控制 |
|---|---|---|---|
qwen-image-2.1-turbo |
$0.02 | 1–10,可选 | aspect_ratio(5 个取值) |
qwen-image-3.0/text-to-image |
$0.0358 | 独立的 image-to-image 端点,1–3 | aspect_ratio(8 个取值)+ resolution 1K/2K |
qwen-image-2.0 |
$0.0422 | 不支持 | size(5 个取值) |
qwen-image-2.1-pro |
$0.05 | 1–10,可选 | aspect_ratio(5 个取值) |
qwen-image-3.0-pro/text-to-image |
$0.0497(1K)/ $0.0993(2K) | 独立的 image-to-image 端点,1–3 | aspect_ratio(8 个取值)+ resolution |
qwen-image-2.0-pro |
$0.107 | 不支持 | size(5 个取值) |
- 生产环境已在使用 2.0:不会有任何问题;它仍然可用。切换到 3.0 成本更低,但你需要把
size替换为aspect_ratio和resolution。 - 新项目:从 Qwen Image 3.0 或 2.1 Turbo 开始。它们更便宜,而且可以编辑现有图像。
- 最高质量的 Qwen 输出:3.0 Pro 的 1K 版本价格不到 2.0 Pro 的一半。
3.0 的用法见 Qwen Image 3.0 API 指南。
常见问题
Qwen Image 2.0 能编辑现有图像吗?
不能。2.0 的两个档位都不接受图像。Qwen Image 3.0 有 image-to-image 端点,2.1 Pro 和 Turbo 可在同一请求中接受最多 10 张参考图像。
它能渲染中文文本吗?
能,这是它的强项。在上面的示例中,我们要求的每个中英文字符串都正确拼写呈现。未要求的文字,例如拉面店中的灯笼,仍可能以杂散字符形式出现。
如何再次得到同一张图像?
传入相同的 seed、提示词和尺寸。这也能让你把提示词从 2.0 迁移到 Pro,并保持相似的版式。
为什么 2.0 比 3.0 更贵?
每个模型有自己的定价。按今日价格,3.0 每张图像 $0.0358,2.0 为 $0.0422。如果价格重要,请先在自己的提示词上比较两者再做决定。
想不用代码试用提示词,请打开 Qwen Image 2.0 模型页。