生图与视频
生图和视频模型都在 image-all 分组,创建密钥时选这个分组。各模型价格见模型广场 · image-all。
生成图片
curl --fail-with-body -sS https://api.peroai.cc/v1/images/generations \
-H "Authorization: Bearer $PEROAI_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-image-2.5-flare",
"prompt": "a small red circle on white",
"n": 1,
"size": "1024x1024"
}'
返回示例(2026-11-15 实测,耗时约 15 秒):
{
"created": 1794739440,
"data": [
{ "b64_json": "iVBORw0KGgo...", "mime_type": "image/png" }
]
}
图片以 base64 返回(b64_json),不是图片链接。把它解码后保存成文件,例如用 Python:
import base64, json, sys
r = json.load(sys.stdin)
open("out.png", "wb").write(base64.b64decode(r["data"][0]["b64_json"]))
尺寸和价格档位
图片按张计费,n 张就收 n 张的钱。尺寸决定档位:
| 档位 | 判断方式 |
|---|---|
| 1K | size 两边都不超过 1024,或写 1K |
| 4K | 任意一边超过 2048,或写 4K |
| 2K | 其余情况,包括不传 size |
部分模型各档同价,以模型广场为准。
生成视频
视频是异步任务:先提交,再轮询状态,完成后下载。
1. 提交任务
curl --fail-with-body -sS https://api.peroai.cc/v1/videos \
-H "Authorization: Bearer $PEROAI_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "minimax-h3-base-fast",
"prompt": "A red ball bouncing once on a white floor.",
"seconds": 5,
"size": "1344x768"
}'
返回任务 ID:
{ "id": "task_xxxxxxxx", "object": "video", "model": "minimax-h3-base-fast", "status": "queued", "progress": 0 }
提交时就按时长扣费。参数不符合模型要求(时长、尺寸、参考素材数量)会直接返回 400,不扣费。
2. 查询状态
curl -sS https://api.peroai.cc/v1/videos/task_xxxxxxxx -H "Authorization: Bearer $PEROAI_API_KEY"
status 依次为 queued → in_progress → completed 或 failed。建议每 10–15 秒查一次。实测 5 秒的视频约 3 分钟完成。任务失败会自动退回费用。
3. 下载视频
curl -sS -o out.mp4 https://api.peroai.cc/v1/videos/task_xxxxxxxx/content \
-H "Authorization: Bearer $PEROAI_API_KEY"
也可以在控制台「任务日志」里查看任务进度和结果。
各模型支持的参数
| 模型 | 时长 seconds |
尺寸 size |
参考图 | 参考视频 / 音频 |
|---|---|---|---|---|
minimax-h3-*(base / cinematic / origin 各档) |
5、10、15 | 1344x768、768x1344 | 最多 2 张(首帧 / 尾帧,每张不超过 5 MB) | — |
video-ray |
10 | 1280x720、720x1280 | 1 张(首帧) | — |
muse-video |
10、20、30、60 | 1280x720、720x1280 | 最多 4 张 | — |
DB-SD-2.0-Fast |
15 | 1280x720、720x1280 | 最多 9 张 | — |
seedance2.5-V |
30 | 1280x720、720x1280 | 最多 9 张 | 各最多 3 个 |
JL-minimax-video-h3-2k |
10、15(同价) | 2560x1440、1440x2560 | 最多 9 张 | — |
- 不传
seconds和size时,取表中的第一个值。 - 参考素材分别放在
reference_images、reference_videos、reference_audios数组里。 minimax-h3-*系列输出带音轨。- 视频按秒计费(
JL-minimax-video-h3-2k按条),单价见模型广场。
目前只实测过纯文字生成视频;带参考素材的请求请先用一个短时长、低价的模型试一次。