通用接口

文件上传

Markdown
POSThttps://api.storymo.art/v1/files

POST /v1/files

上传本地参考素材,获得可在图片或视频生成中使用的 file_id。

认证

请求头 Authorization: Bearer YOUR_API_KEY。API Key 可在网站“开发者 API”页面创建。

请求格式

multipart/form-data,字段名 file,每次上传一个文件。客户端自动生成 Content-Type 和 boundary。

参数类型必填说明
filebinary是图片、视频或音频;最大 100 MiB(104857600 字节)

MIME 必须为 image/*、video/* 或 audio/*,例如 image/png、video/mp4、audio/mpeg。生成时仍受具体模型的媒体格式和数量限制。上传不创建生成任务。

成功响应

HTTP 201。

字段类型说明
file_idstring文件标识,用于 references[].file_id
fileIdstringfile_id 的兼容别名
urlstring当前下载链接,可能有有效期
filenamestring原文件名
sizeinteger文件字节数
mime_typestring媒体 MIME 类型

用于生成请求

references: [{"type":"image","file_id":"上传返回的file_id"}]

file_id 只可由当前账户使用,参考项的 type 必须与文件媒体类型一致。file_id 是不透明标识,可能以 cloud:// 等形式开头。

curl --request POST "https://api.storymo.art/v1/files" \
  --header "Authorization: Bearer $DRAMAGEN_API_KEY" \
  --form "file=@./reference.png;type=image/png"
响应示例
{
  "code": "ok",
  "message": "success",
  "data": {
    "file_id": "cloud://example/reference.png",
    "fileId": "cloud://example/reference.png",
    "url": "https://cdn.example.com/reference.png",
    "filename": "reference.png",
    "size": 123456,
    "mime_type": "image/png"
  },
  "requestId": "req_example"
}