如何使用 Qwen Image 2.1 Turbo 文生图 API:文生图接入指南(2026)
Qwen Image 2.1 Turbo 文生图 API 接入教程:参数说明、价格与可直接运行的调用代码,先在 Playground 试玩再一行代码接入。
Qwen Image 2.1 Turbo 文生图 是一款文生图模型(由 Alibaba 提供):根据提示词生成 1~6 张图片,支持提示词扩展和思考模式。在 NamiFusion 上可以在 Playground 直接试玩(提交前显示准确报价),再通过统一 REST API 一行代码接入,典型一次调用约 $0.016。
TL;DR
· 任务类型:文生图,由 Alibaba 提供
· 价格:典型一次调用约 $0.016($1 = 100 积分),按量计费无订阅
· 上手路径:Playground 试玩(提交前显示报价)→ API Keys 建密钥 → 一个 POST 接入
· 可调参数:7 个(见下方参数表)
· 无平台水印,商用可用(遵守服务条款)
用 Qwen Image 2.1 Turbo 文生图 能做什么?
社媒配图与封面:按帖子主题批量出图,统一风格后直接排期发布。
电商与广告素材:产品场景图、Banner 底图、A/B 测试的多版本视觉。
概念设计与灵感探索:角色、场景、风格板,用低成本快速迭代方向。
内容工作流串联:生成结果可直接作为图生视频或换脸的输入素材。
怎么调用这个 API?
- 在 NamiFusion 注册并在 API Keys 页面创建密钥(注册赠送积分仅可用于指定模型)。
- 用下面的 cURL 示例提交任务,Header 带上 Bearer 密钥。
- 用返回的 task_uuid 轮询任务状态,完成后取输出 URL。
# 1) Submit — returns { "task_uuid": "..." }
curl -X POST "https://www.namifusion.com/api/v1/marketplace/run/alibaba/qwen-image-2.1-turbo/text-to-image" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"prompt": "A cozy futuristic reading nook inside a glass-walled apartment overlooking a rainy cyberpunk city at dusk, warm ambient lighting, a woman sitting in a curved chair reading a book, shelves with plants and soft blankets, realistic textures, cinematic composition, highly detailed, polished typography on a subtle book cover only, no extra text in the image, no watermark",
"n": 1,
"size": "2048*2048",
"prompt_extend": true,
"prompt_extend_mode": "direct",
"enable_thinking": true,
"seed": 12345
}
}'
# 2) Poll until status is "completed", then read the output URLs
curl "https://www.namifusion.com/api/v1/marketplace/run/tasks/TASK_UUID" \
-H "Authorization: Bearer YOUR_API_KEY"有哪些参数?
prompt(提示词):必填
n(生成张数):可选,默认 1
size(尺寸):可选
prompt_extend(智能改写):可选,默认 true
prompt_extend_mode(改写方式):可选,默认 "direct"
enable_thinking(思考模式):可选,默认 true
seed(随机种子):可选
Qwen Image 2.1 Turbo 文生图 的提示词怎么写?
- 主体在前:先写画面主角与动作,再补环境、光线、风格("一名宇航员在雨中的霓虹街头奔跑,电影感,浅景深")。
- 用具体名词代替形容词堆砌:"85mm 人像镜头、黄昏逆光" 比 "非常好看、超高质量" 有效得多。
- 迭代时只改一个变量:固定 seed 复现结果,每次只调整一个描述词,才能知道是什么在起作用。
- 负面信息放正面写:与其说"不要模糊",不如直接要"锐利对焦、清晰细节"。
价格是多少?
按次积分计价,典型一次调用约 $0.016($1 = 100 积分),实际价格随参数(分辨率/时长等)变化,Playground 里提交前会显示准确报价。
Qwen Image 2.1 Turbo 文生图
alibaba/qwen-image-2.1-turbo/text-to-image
根据提示词生成 1~6 张图片,支持提示词扩展和思考模式。
参数
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | true | — | 用于描述目标图片的文本提示词,支持中文和英文,建议不超过 4500 Token。本模型不支持反向提示词,不希望出现的内容请直接写在提示词中(如“画面中不要出现文字”)。描述透明背景、贴纸、抠图等需求时,模型会自动输出带透明通道的 PNG; max 5000 characters |
n | integer | false | 1 | 单次生成 1-6 张图片,按成功生成的张数计费 [1, 6] |
size | string | false | — | 格式为宽高,总像素 512512 至 20482048,宽高比 1:8 至 8:1。推荐:20482048(1:1)、26881536(16:9)、15362688(9:16)、23681728(4:3)、17282368(3:4)。留空时由模型根据提示词自动推荐分辨率。; max 16 characters |
prompt_extend | boolean | false | true | 自动扩写优化提示词,官方建议开启,对短提示词效果提升明显 |
prompt_extend_mode | string | false | "direct" | direct:直接增强,适用于大多数场景;agent:智能体增强,改写效果更精细 direct, agent |
enable_thinking | boolean | false | true | 开启后增强推理以提升出图质量,但会增加生成耗时。仅在开启智能改写时生效 |
seed | integer | false | — | 用于结果复现,取值 0-2147483647,留空表示随机 [0, 2.14748e+09] |
价格
每张成功生成的图片 $0.016(1.6 积分)。按请求 n 预扣,按实际成功输出张数结算。参考图片、输出尺寸、提示词扩展均不额外收费。默认 n=1。
size 使用宽*高格式,总像素为 512²~2048²,宽高比 1:8~8:1;省略时自动选择。省略 seed 使用随机种子。enable_thinking 仅在 prompt_extend=true 时生效。
采用 Alibaba International 国际部署标准美元标价。1 美元=100 积分,账户折扣另行计算。
API
curl -X POST https://www.namifusion.com/api/v1/marketplace/run/alibaba/qwen-image-2.1-turbo/text-to-image \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"input": {
"n": 1,
"seed": 12345,
"size": "2048*2048",
"prompt": "A cozy futuristic reading nook inside a glass-walled apartment overlooking a rainy cyberpunk city at dusk, warm ambient lighting, a woman sitting in a curved chair reading a book, shelves with plants and soft blankets, realistic textures, cinematic composition, highly detailed, polished typography on a subtle book cover only, no extra text in the image, no watermark",
"prompt_extend": true,
"enable_thinking": true,
"prompt_extend_mode": "direct"
}
}'
curl 'https://www.namifusion.com/api/v1/marketplace/run/tasks/TASK_UUID' \
-H "Authorization: Bearer $API_KEY"
使用 task_uuid 轮询至 completed 或 failed。成功时 output.images 为输出 URL 字符串数组。
常见问题
可以先免费试用吗?+
注册赠送积分仅可用于指定模型,适用范围会持续更新;Playground 提交前会显示准确报价。
生成内容可以商用吗?有水印吗?+
可以商用,NamiFusion 不给生成结果加平台水印;使用须遵守服务条款与适用法律。
内容政策是什么?+
色情内容、涉及未成年人的性化内容、未经授权使用真人、欺骗性冒充、诈骗与虚假代言均禁止。合法、自愿且非露骨的成年人主题可能被允许,详见服务条款。
Qwen Image 2.1 Turbo 文生图 的任务要跑多久?+
取决于参数,图像通常数秒到数十秒,视频通常数十秒到几分钟;API 返回 task_uuid 供轮询。
分辨率/时长上限是多少?+
以模型参数表为准:每个模型的可选分辨率、时长档位都在上方参数说明与 Playground 中列出。