LogoLogoAPI 文件
LogoLogoAPI 文件
首頁
總覽驗證與冪等性影像生成影像編輯影像轉換任務與限時等待點數錯誤速率限制與併發API 變更紀錄
API 文件

影像編輯

以自然語言指令編輯上傳的影像

POST /api/v1/images/edits 接受 multipart/form-data。所需權限範圍: images:edit。

表單欄位

欄位型別必填預設值規則
imagefile是—PNG、JPEG 或 WebP;最大 10 MiB,解碼後最多 4,000 萬像素
promptstring是—編輯指令,5–2,000 字元
aspect_ratiostring否依來源影像而定與生成相同的公開比例
resolutionstring否2K2K 或 4K
countinteger否11–4

檔案簽章的檢查獨立於宣告的 MIME 類型。無效、超出大小或不安全的影像會回傳 400 INVALID_REQUEST,或以相同公開錯誤碼回傳 HTTP 413。

點數

解析度每張輸出點數
2K10
4K20

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 


上傳的來源影像屬於任務的非公開輸入,不會出現在任何任務或日誌回應中。冪等重複的 上傳會被丟棄,已受理的來源影像則在產生終態結果後刪除。

影像生成

建立文字生成影像的任務

影像轉換

將影像轉為 SVG、PPTX、PNG、PDF 或 TIFF

目錄

表單欄位
點數
cURL
JavaScript
Python
headers: { Authorization: `Bearer ${apiKey}`, 'Idempotency-Key': crypto.randomUUID() },
body: form,
});
{
api_key
}
"
,
"Idempotency-Key"
:
str
(uuid.uuid4())},
files={"image": ("figure.png", image, "image/png")},
data={"prompt": "Move the legend below the diagram"},
)