API 文件
影像編輯
以自然語言指令編輯上傳的影像
POST /api/v1/images/edits 接受 multipart/form-data。所需權限範圍:
images:edit。
表單欄位
| 欄位 | 型別 | 必填 | 預設值 | 規則 |
|---|---|---|---|---|
image | file | 是 | — | PNG、JPEG 或 WebP;最大 10 MiB,解碼後最多 4,000 萬像素 |
prompt | string | 是 | — | 編輯指令,5–2,000 字元 |
aspect_ratio | string | 否 | 依來源影像而定 | 與生成相同的公開比例 |
resolution | string | 否 | 2K | 2K 或 4K |
count | integer | 否 | 1 | 1–4 |
檔案簽章的檢查獨立於宣告的 MIME 類型。無效、超出大小或不安全的影像會回傳
400 INVALID_REQUEST,或以相同公開錯誤碼回傳 HTTP 413。
點數
| 解析度 | 每張輸出點數 |
|---|---|
2K | 10 |
4K | 20 |
cURL
curl https://sci-draw.com/api/v1/images/edits \
-H 'Authorization: Bearer sd_YOUR_KEY' \
-H 'Idempotency-Key: revise-figure-7-v2' \
-F 'image=@figure.png;type=image/png' \
-F 'prompt=Move the legend below the diagram and increase label contrast' \
-F 'resolution=2K' \
-F 'count=1'JavaScript
const form = new FormData();
form.set('image', file);
form.set('prompt', 'Move the legend below the diagram');
const response = await fetch('https://sci-draw.com/api/v1/images/edits', {
method: 'POST',
Python
with open("figure.png", "rb") as image:
response = requests.post(
"https://sci-draw.com/api/v1/images/edits",
headers={"Authorization": f"Bearer
上傳的來源影像屬於任務的非公開輸入,不會出現在任何任務或日誌回應中。冪等重複的 上傳會被丟棄,已受理的來源影像則在產生終態結果後刪除。

API 文件