圖片編輯
在 CometAPI 中使用 POST /v1/images/edits,透過 multipart 上傳、遮罩、GPT 圖像模型與編碼圖像輸出控制來編輯圖片。
使用此路由可在 CometAPI 上透過與 OpenAI 相容的 multipart 上傳來編輯現有圖片。Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
在以下情況使用此路由
- 你已經有來源圖片,並且想要進行由 prompt 驅動的編輯
- 你可能需要使用遮罩來進行針對性的變更
- 你可以處理 multipart 檔案上傳,而不是純 JSON 請求
安全的第一個請求
- 先從一個 PNG 或 JPG 檔案開始
- 在基礎編輯流程可正常運作之前,先不要使用遮罩
- 在此路由上進行 GPT 圖像編輯請求時,使用
model: "gpt-image-2" - 使用一則簡短指令,要求一項可見的變更
- 從
data[0].b64_json讀取編輯後的結果 - 當你想要 JPEG payload 時,設定
output_format: "jpeg" - 預期延遲會比一般圖片生成更長
模型行為
- 此路由上的 GPT 圖像編輯模型會回傳內嵌的 base64 圖像資料
output_format會控制b64_json內部的編碼圖像類型response_format只在模型支援 URL 輸出時才有作用qwen-image-edit會在相同的 CometAPI 路由後方遵循供應商特定的編輯行為
授權
Bearer token authentication. Use your CometAPI key.
主體
Source image file. Start with one PNG or JPG input for the simplest flow.
Edit instruction describing the change you want.
"Add a small red ribbon to the paper boat."
The image editing model to use. Choose a supported model from the Models page.
Optional PNG mask. Transparent areas indicate regions that should be edited.
Number of edited images to return.
Quality setting for models that support it.
high, medium, low Requested response container when supported by the selected model. GPT image edit models return data[].b64_json; use output_format to choose the encoded image type.
url, b64_json Encoded image type for GPT image edit results returned in data[].b64_json. For example, use jpeg for a JPEG payload.
"jpeg"
Requested output size when supported by the selected model.