APIMaster.ai

qwen_image_edit_spicy — 使用与参数

图片编辑。公开模型 ID 为 qwen_image_edit_spicy,基础价格为每张成功图片 $0.040。APIMaster 请求中使用这个下划线 ID。

qwen_image_edit_spicy

图片编辑。公开模型 ID 为 qwen_image_edit_spicy,基础价格为每张成功图片 $0.040。APIMaster 请求中使用这个下划线 ID。

使用 APIMaster API key,请求头为 Authorization: Bearer。JSON 使用 Content-Type: application/json;multipart 让 cURL/requests 自动设置 boundary。https://apimaster.ai/v1 已包含 /v1。

POST https://apimaster.ai/v1/images/generations · application/json

示例使用同步接口:服务端等待并轮询已经受理的上游任务,客户端收到最终 Images 结果,不是供应商任务 UUID。设置足够长的读取超时(如 750 秒),不使用流式输出。

参数说明

字段 / 类型 规则与默认值
model · string 必填,必须使用上方准确的公开模型 ID。
prompt · string 必填非空字符串,描述目标图片或编辑指令。
n · integer = 1 可选整数,只支持 1,默认 1。
response_format · string = url 可选字符串:url(默认)或 b64_json。
image · string 必填主图:可访问的图片 URL 或 data URI(data:image/png;base64,...)。
reference_images · string[] | null = null; [] 可选字符串数组,最多两张额外参考图,支持同样的 URL/data URI。包含主图在内总共最多三张。
images / image_urls · string[] 另一种有序图片数组写法,第一张是主图,其余最多两张为参考图。只选一种输入方式,避免重复。
seed · integer | null = null 可选整数或 null,默认 null;0 或 null 使用随机种子。上游未公开数值范围,不要套用 Z Image 的范围。
size · string = auto 可选,只支持 auto。输出尺寸随主图,不要发送 width/height。
quality · standard; stream · false 不支持:n>1、stream=true、mask/mask_url、style、background、output_format 和 watermark。quality 省略或使用 standard,不提供额外质量档位。未知额外参数会被拒绝。
resolution Qwen 必须提供一张主图,最多两张参考图。JSON 的 image、images、image_urls、reference_images 按此顺序合并;建议只用 image 加 reference_images,避免重复。不能使用 prompt_extend 或显式尺寸,省略 resolution。

调用示例

cURL · JSON

curl --max-time 750 'https://apimaster.ai/v1/images/generations' \
  -H "Authorization: Bearer $APIMASTER_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{
  "model": "qwen_image_edit_spicy",
  "prompt": "Change the red paper boat to blue. Keep the pond and lighting unchanged.",
  "n": 1,
  "response_format": "url",
  "seed": 0,
  "image": "https://example.com/primary.png",
  "reference_images": [
    "https://example.com/reference.png"
  ]
}'

Python · requests

import os
import requests

api_base = "https://apimaster.ai/v1"
payload = {
    "model": "qwen_image_edit_spicy",
    "prompt": "Change the red paper boat to blue. Keep the pond and lighting unchanged.",
    "n": 1,
    "response_format": "url",
    "seed": 0,
    "image": "https://example.com/primary.png",
    "reference_images": [
        "https://example.com/reference.png"
    ]
}
response = requests.post(
    api_base + "/images/generations",
    headers={"Authorization": "Bearer " + os.environ["APIMASTER_API_KEY"]},
    json=payload,
    timeout=(20, 750),
)
response.raise_for_status()
result = response.json()
print(result)

cURL · multipart

multipart /images/edits 使用 image、重复的 image[] 或 images 上传图片文件,每个文件须为图片,大小 1 字节至 10 MiB。第一张为主图,请统一使用同一种文件字段。multipart 的 reference_images 值为 URL/data URI 字符串的 JSON 数组。

curl --max-time 750 'https://apimaster.ai/v1/images/edits' \
  -H "Authorization: Bearer $APIMASTER_API_KEY" \
  -F 'model=qwen_image_edit_spicy' \
  -F 'prompt=Change the red paper boat to blue.' \
  -F 'n=1' \
  -F 'response_format=b64_json' \
  -F 'seed=0' \
  -F 'image[]=@primary.png' \
  -F 'image[]=@reference.png'

返回与计费

成功时 HTTP 200 返回 created(Unix 秒)及只有一个元素的 data 数组。url 是可下载的图片地址,请及时保存;b64_json 为图片字节的 base64。除状态码外,也应校验图片内容。

{"created": 1793380000, "data": [{"url": "https://example.com/generated.png"}]}
{"created": 1793380000, "data": [{"b64_json": "BASE64_IMAGE_BYTES"}]}

基础价格按张计费;最终扣费受已有渠道、分组和账户倍率影响,以模型广场与消费日志为准。支持范围内的尺寸、参考图数量不单独加价,示例均为 n=1。

qwen_image_edit_spicy

限制与排错

不支持:n>1、stream=true、mask/mask_url、style、background、output_format 和 watermark。quality 省略或使用 standard,不提供额外质量档位。未知额外参数会被拒绝。

Qwen 必须提供一张主图,最多两张参考图。JSON 的 image、images、image_urls、reference_images 按此顺序合并;建议只用 image 加 reference_images,避免重复。不能使用 prompt_extend 或显式尺寸,省略 resolution。

400 参数错误需修正参数;上游拒绝或失败会返回错误。超时、断连或受理结果未知不代表没有生成:保留请求 ID,先查消费日志或联系支持,再决定是否提交新的付费 POST。适配器不会自动重新提交已受理的上游任务。


图片 API 总览 · z-image-spicy-pro

上游规格核查日期 2026-10-30。本文参数以已部署的 APIMaster 适配器为准,不直接照搬上游创建和轮询接口。

MuleRouter API