申请上传地址
申请素材上传地址,有效期 300 秒。上传时须原样携带返回的 headers,上传完成后调用确认接口。每个账号每分钟最多申请 30 次、任意连续 24 小时内最多 500 MiB;超出时返回 429,响应可包含 quota 详情。
认证
API Key:X-API-Key: <API Key> 或 Authorization: Bearer <API Key>。
示例中的凭证为占位值,请替换后在服务器端运行。
代码示例
curl -X POST 'https://shixux.com/api/v1/uploads' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -d '{"filename":"voice.wav","content_type":"audio/wav","size_bytes":1048576,"purpose":"voice_reference","rights_confirmed":true}'{ "upload_url": "example", "expires_in": 1, "asset_id": "example", "headers": {}, "delete_after": "2026-10-06T10:00:00Z"}application/json- body
content_type*Content Type文件的 MIME 类型,须与文件扩展名一致。支持 WAV、MP3、FLAC、M4A、OGG、PNG、JPEG、WebP 和 MP4,可用格式取决于 purpose;声音和情绪参考必须为 audio/wav。
filename*Filename文件名,扩展名必须与 content_type 一致。
长度
length <= 255display_name?Display Name长度
length <= 80purpose?Purpose素材用途:voice_reference(声音参考)、emotion_reference(情绪参考)、audio_material(音频编排的音效或配乐)、image_reference(图生图参考图)、video_image、video_clip、video_audio(视频生成的参考图片、视频和音频)。生成接口引用素材时会校验用途。
Match
^(input|api_input|voice_reference|emotion_reference|audio_material|image_reference|video_image|video_clip|video_audio)$默认
"input"rights_confirmed?Rights Confirmed确认已取得素材中的作品、人物形象和声音的使用授权。传入 true 时记录确认时间。
默认
falsesize_bytes*Size Bytes文件的实际字节数。声音参考、情绪参考和图片最大 20 MiB,参考视频最大 50 MiB,视频参考音频最大 15 MiB,其他音频最大 100 MiB。
范围
1 <= value <= 104857600请求成功
application/json- response
asset_id*Asset Iddelete_after*|未确认的上传将被删除的时间。
expires_in*Expires In上传地址的有效秒数(300 秒)。请在申请后 1 小时内调用确认接口。
upload_url*Upload Urlheaders*PUT 上传时须原样携带的全部请求头。Content-Length 为申请时声明的大小,浏览器会自动设置。