API 文档
图片生成
创建文生图任务
POST /api/v1/images/generations 根据文本描述生成 1–4 张图片。
所需权限:images:generate。
JSON 请求体
| 字段 | 类型 | 必填 | 默认值 | 规则 |
|---|---|---|---|---|
prompt | string | 是 | — | 去除首尾空格后 5–2,000 字符 |
aspect_ratio | string | 否 | 1:1 | 1:1、16:9、9:16、4:3、3:4、3:2、2:3、5:4、4:5 或 21:9 |
resolution | string | 否 | 2K | 2K 或 4K |
count | integer | 否 | 1 | 1–4 |
未知字段会被拒绝;公开请求不包含能力调度选项。
积分
| 分辨率 | 每张积分 |
|---|---|
2K | 5 |
4K | 20 |
预留积分等于单张成本乘以 count。任务接受时原子预留,成功后结算,终态失败时释放。
cURL
curl https://sci-draw.com/api/v1/images/generations \
-H 'Authorization: Bearer sd_YOUR_KEY' \
-H 'Idempotency-Key: manuscript-42-panel-a' \
-H 'Prefer: wait=10' \
-H 'Content-Type: application/json' \
-d '{"prompt":"A labeled plant cell diagram","aspect_ratio":"4:3","resolution":"2K","count":1}'Python
import os, uuid, requests
response = requests.post(
"https://sci-draw.com/api/v1/images/generations",
headers={
"Authorization": f"Bearer {os.environ['SCIDRAW_API_KEY']}"
任务处于排队或处理中时返回 202;有限等待命中终态时返回 200。完整响应和轮询流程见
任务。

API 文档