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