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 文档