上传素材
本地图片、视频先换取预签名地址,再直传对象存储,拿到公网 HTTPS 后写入生成请求。上传需要本站 Key。
第一步:换取预签名地址
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
URL | string | 是 | https://api.oiovideo.com/api/media/presign |
方法 | string | 是 | POST |
Authorization | string | 是 | Bearer YOUR_API_KEY |
Content-Type | string | 是 | application/json |
filename | string | 是 | 原始文件名,决定对象扩展名与 MIME |
size | integer | 是 | 文件字节数,必须与实际上传一致(已参与签名) |
curl -X POST https://api.oiovideo.com/api/media/presign \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"filename": "ref.png", "size": 245760}'
第二步:上传文件
用返回的 upload_url 发 PUT,必须带返回的 Content-Type(它已参与签名,不一致会被拒)。
curl -X PUT "<upload_url>" \
-H "Content-Type: <content_type>" \
--data-binary @ref.png
成功响应(第一步)
{
"upload_url": "https://img.oiovideo.com/api/upload/refs/20260918/9b2e4904560b3e9130b3fd349a7e80f1.png?exp=...&sig=...",
"method": "PUT",
"headers": {"Content-Type": "image/png", "Content-Length": "245760"},
"key": "refs/20260918/9b2e4904560b3e9130b3fd349a7e80f1.png",
"url": "https://img.oiovideo.com/refs/20260918/9b2e4904560b3e9130b3fd349a7e80f1.png",
"expires_in": 900
}
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
upload_url | string | 是 | 带签名的上传地址,15 分钟内有效;直接对它发 PUT |
headers | object | 是 | PUT 时必须原样带上 |
key | string | 是 | 对象路径(服务端生成,无需关心) |
url | string | 是 | 公网 HTTPS,写入后续生成请求 |
第三步:写入生成请求
# 图像
"images": ["https://img.oiovideo.com/samples/ref-character.jpg"]
# 视频参考图 / 参考视频
"image_urls": ["https://img.oiovideo.com/samples/ref-character.jpg"]
"video_urls": ["https://img.oiovideo.com/samples/demo.mp4"]
支持 png / jpg / jpeg / webp / gif / mp4 / mov / webm / mp3 / wav / m4a。上传的素材请勿用于长期存储。参考音频同样用本流程上传后写入 audio_urls。提交见 视频生成,生图见 图像接口。
素材只收公网 URL:所有生成请求都必须是公网 HTTPS 地址(本站图床或你自己的图床均可)。随请求上传的文件、Data URI 一律 413 拒绝;素材地址需在上传后 1 小时内使用。