上传
一次生成可为任意图像输入接受一个上传 id。上传一次,然后在其存在期间,按需在任意多个请求中复用该 id。
shell
curl -sS -X POST https://api.dreamutopia.net/v1/uploads \
-H "Authorization: Bearer $DREAMUTOPIA_API_KEY" \
-F "file=@/path/to/photo.png"response 201
{
"id": "<upload_id>",
"url": "<upload_url>",
"expires_at": "2026-10-31T12:00:00Z"
}规则
- 一个名为
file的多部分部分。 - JPEG、PNG 或 WebP,由文件字节决定——而非该部分的 Content-Type。
- 最大 30 MB。更大的请求会在对象存储之前被拒绝。
- 返回的
id是一个不透明句柄。请将其视为不透明;它仅对上传它的账户有效。 - 签名后的
url有效期为七天。建议优先使用id:它会在使用时重新签名。
使用上传功能
在生成的 media 字段中传入 id:
image → image
curl -sS -X POST https://api.dreamutopia.net/v1/images/generations \
-H "Authorization: Bearer $DREAMUTOPIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"lite","prompt":"the same scene in watercolor","resolution":"2k","aspect_ratio":"adaptive","reference_images":["<upload_id>"]}'image → video
curl -sS -X POST https://api.dreamutopia.net/v1/videos/generations \
-H "Authorization: Bearer $DREAMUTOPIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"medium","prompt":"a gentle camera push","image":"<upload_id>","resolution":"720p","duration":8}'链式调用与清理
已完成生成的 result.url 可用于任何接受上传 ID 的位置,因此一个任务可以承接下一个任务。图片引用不接受外部 URL。未被任何生成引用的已上传对象会在保留期结束后被移除;被使用过的对象则在其生成存在期间一直保留。