Hy Image 3.5 Preview · API 參數與計費
支援文生圖、參考圖生圖與多輪圖片編輯。
請使用有效的 APIMaster API 金鑰,以 Bearer 驗證傳送 JSON 請求。
POST /v1/wand/hunyuan-image/v35-generation · Content-Type: application/json
請求參數
| 欄位 | 型別 | 說明 |
|---|---|---|
model |
string |
hy-image-v3.5-preview(必填)。 |
messages |
object[] |
依時間排序的訊息陣列。最後一則 user 訊息是本輪指令,前面的訊息用於編輯上下文。必填。 |
size |
string |
以 寬x高 指定尺寸,例如 4096x4096。每邊介於 256 至 8192 像素,總面積不得超過 16,777,216 像素。 |
seed |
int64 |
介於 0 和 2⁶³−1 的整數。省略或填 0 時使用隨機種子。 |
generate_max_pixels |
integer |
省略 size 時生效。可選 1,048,576、2,359,296(預設)或 4,194,304。中間值取最接近的級距。4K 請用 size。 |
resize_max_pixels |
integer |
超出此面積的參考圖會等比例縮小,預設 1,048,576 像素。 |
session |
string |
同一編輯會話維持相同值,便於重用路由和 KV 快取。 |
footnote |
string |
右下角的自訂浮水印,最多 16 個 Unicode 字元。 |
use_search_tool |
object |
使用 {"value":true} 或 {"value":false},預設關閉搜尋。 |
訊息包含 role(user、assistant 或 tool)和 content 陣列。文字使用 type=text 和 text,圖片使用 type=image_url 和 image_url:{url:...}。圖片接受公開 URL 或含 MIME 前綴的資料 URI,單張最多 20 MB,上下文最多 20 張圖片及 100,000 tokens。回傳工具結果時帶上對應的 tool_call_id,已生成圖片以 is_generate:true 標記。
assistant 可原樣傳回 reasoning 與 tool_calls。若只呼叫工具,可省略 content。工具呼叫格式是 {id,type:"function",function:{name,arguments}},其中 arguments 為 JSON 字串。
curl -X POST "https://apimaster.ai/v1/wand/hunyuan-image/v35-generation" \
-H "Authorization: Bearer $APIMASTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"hy-image-v3.5-preview","size":"1024x1024","messages":[{"role":"user","content":[{"type":"text","text":"白色背景上的藍色圓形"}]}]}'
回應
回應可能包含連續 JSON 影格,請依實際 Content-Type 處理。最終圖片位於 choices[0].delta.image.url,尺寸見 width 和 height。成功時 finish_reason 也可能是 null。請確認圖片 URL 並在有效期內下載。下一輪編輯可沿用 assembled_history。遇到錯誤或斷線時,請保留 request_id 供排查;重新提交可能再次扣款。
計費
閘道先預留額度,再依 tokenhub_usage.total_tokens 結算一次。APIMaster 即時價格以模型卡為準。
