如何使用 Qwen Image 2.1 Pro 图片编辑 API:图生图接入指南(2026)

2 min · 更新于 2026-07-11 · NamiFusion 团队

Qwen Image 2.1 Pro 图片编辑 API 接入教程:参数说明、价格与可直接运行的调用代码,先在 Playground 试玩再一行代码接入。

Qwen Image 2.1 Pro 图片编辑 是一款图生图模型(由 Alibaba 提供):使用提示词和 1~10 张参考图编辑图片,单次生成 1~6 张。在 NamiFusion 上可以在 Playground 直接试玩(提交前显示准确报价),再通过统一 REST API 一行代码接入,典型一次调用约 $0.040。

TL;DR

· 任务类型:图生图,由 Alibaba 提供

· 价格:典型一次调用约 $0.040($1 = 100 积分),按量计费无订阅

· 上手路径:Playground 试玩(提交前显示报价)→ API Keys 建密钥 → 一个 POST 接入

· 可调参数:7 个(见下方参数表)

· 无平台水印,商用可用(遵守服务条款)

用 Qwen Image 2.1 Pro 图片编辑 能做什么?

社媒配图与封面:按帖子主题批量出图,统一风格后直接排期发布。

电商与广告素材:产品场景图、Banner 底图、A/B 测试的多版本视觉。

概念设计与灵感探索:角色、场景、风格板,用低成本快速迭代方向。

内容工作流串联:生成结果可直接作为图生视频或换脸的输入素材。

怎么调用这个 API?

  1. 在 NamiFusion 注册并在 API Keys 页面创建密钥(注册赠送积分仅可用于指定模型)。
  2. 用下面的 cURL 示例提交任务,Header 带上 Bearer 密钥。
  3. 用返回的 task_uuid 轮询任务状态,完成后取输出 URL。
提交任务
# 1) Submit — returns { "task_uuid": "..." }
curl -X POST "https://www.namifusion.com/api/v1/marketplace/run/alibaba/qwen-image-2.1-pro/edit" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "prompt": "Using image 1 as the main product reference and image 2 as the lifestyle scene reference, create a clean premium e-commerce hero image of the same leather handbag placed on a light beige stone pedestal in soft natural studio lighting. Keep the bag'\''s exact shape, color, stitching, hardware, and proportions consistent with the reference. Replace the background with a minimal warm neutral setting, add a subtle soft shadow under the bag, and remove any distracting props. No text, no watermark, no extra bags, no people, no logo changes.",
    "images": [
      "https://d1s3annbwribom.cloudfront.net/marketplace/examples/261013/default/254gkbbtuykh.jpeg",
      "https://d1s3annbwribom.cloudfront.net/marketplace/examples/261013/default/5f4s804daar9.jpeg"
    ],
    "n": 1,
    "size": "2048*2048",
    "prompt_extend": true,
    "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(提示词):必填

images(参考图片):必填

n(生成张数):可选,默认 1

size(尺寸):可选

prompt_extend(智能改写):可选,默认 true

enable_thinking(思考模式):可选,默认 true

seed(随机种子):可选

Qwen Image 2.1 Pro 图片编辑 的提示词怎么写?

  1. 主体在前:先写画面主角与动作,再补环境、光线、风格("一名宇航员在雨中的霓虹街头奔跑,电影感,浅景深")。
  2. 用具体名词代替形容词堆砌:"85mm 人像镜头、黄昏逆光" 比 "非常好看、超高质量" 有效得多。
  3. 迭代时只改一个变量:固定 seed 复现结果,每次只调整一个描述词,才能知道是什么在起作用。
  4. 负面信息放正面写:与其说"不要模糊",不如直接要"锐利对焦、清晰细节"。

价格是多少?

按次积分计价,典型一次调用约 $0.040($1 = 100 积分),实际价格随参数(分辨率/时长等)变化,Playground 里提交前会显示准确报价。

Qwen Image 2.1 Pro 图片编辑

alibaba/qwen-image-2.1-pro/edit

使用提示词和 1~10 张参考图编辑图片,单次生成 1~6 张。

参数

ParameterTypeRequiredDefaultDescription
promptstringtrue—描述所需编辑效果的文本提示词,支持中文和英文,建议不超过 4500 Token。本模型不支持反向提示词,不希望出现的内容请直接写在提示词中(如“不要出现文字”)。要求抠图或透明背景时,模型会自动输出带透明通道的 PNG; max 5000 characters
imagesarraytrue—用于编辑的参考图片,1-10 张。单张不超过 10MB,宽高 1-8000 像素(建议 384-2048 像素),长短边比不超过 10:1。多图时按顺序对应提示词中的图1、图2……图10。; 1–10 URLs
nintegerfalse1单次生成 1-6 张图片,按成功生成的张数计费 [1, 6]
sizestringfalse—输出图片尺寸,格式为宽高,总像素 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_extendbooleanfalsetrue自动扩写优化提示词,官方建议开启,对短提示词效果提升明显
enable_thinkingbooleanfalsetrue开启后增强推理以提升出图质量,但会增加生成耗时。仅在开启智能改写时生效
seedintegerfalse—用于结果复现,取值 0-2147483647,留空表示随机 [0, 2.14748e+09]

价格

每张成功生成的图片 $0.04(4 积分)。按请求 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-pro/edit \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "input": {
    "n": 1,
    "seed": 12345,
    "size": "2048*2048",
    "images": [
      "https://d1s3annbwribom.cloudfront.net/marketplace/examples/261013/default/254gkbbtuykh.jpeg",
      "https://d1s3annbwribom.cloudfront.net/marketplace/examples/261013/default/5f4s804daar9.jpeg"
    ],
    "prompt": "Using image 1 as the main product reference and image 2 as the lifestyle scene reference, create a clean premium e-commerce hero image of the same leather handbag placed on a light beige stone pedestal in soft natural studio lighting. Keep the bag'"'"'s exact shape, color, stitching, hardware, and proportions consistent with the reference. Replace the background with a minimal warm neutral setting, add a subtle soft shadow under the bag, and remove any distracting props. No text, no watermark, no extra bags, no people, no logo changes.",
    "prompt_extend": true,
    "enable_thinking": true
  }
}'
curl 'https://www.namifusion.com/api/v1/marketplace/run/tasks/TASK_UUID' \
  -H "Authorization: Bearer $API_KEY"

使用 task_uuid 轮询至 completed 或 failed。成功时 output.images 为输出 URL 字符串数组。

Alibaba official pricing

常见问题

可以先免费试用吗?+

注册赠送积分仅可用于指定模型,适用范围会持续更新;Playground 提交前会显示准确报价。

生成内容可以商用吗?有水印吗?+

可以商用,NamiFusion 不给生成结果加平台水印;使用须遵守服务条款与适用法律。

内容政策是什么?+

色情内容、涉及未成年人的性化内容、未经授权使用真人、欺骗性冒充、诈骗与虚假代言均禁止。合法、自愿且非露骨的成年人主题可能被允许,详见服务条款。

Qwen Image 2.1 Pro 图片编辑 的任务要跑多久?+

取决于参数,图像通常数秒到数十秒,视频通常数十秒到几分钟;API 返回 task_uuid 供轮询。

分辨率/时长上限是多少?+

以模型参数表为准:每个模型的可选分辨率、时长档位都在上方参数说明与 Playground 中列出。