API DOCUMENT
纯梦视频 API 文档
通过纯梦 API 创建视频生成任务和视频工具任务,并使用统一查询接口获取任务状态和结果地址。 外部插件、自动化工具和业务系统只需要使用纯梦 API Key。
通用视频创建任务
请求地址
POST https://puream.cn/api/ai/video/text-to-video/tasks
请求 Header
| 名称 | 必填 | 说明 |
|---|---|---|
Authorization | 是 | Bearer 你的纯梦 API Key |
Content-Type | 是 | application/json |
请求参数
| 字段 | 类型 | 必填 | 示例 | 说明 |
|---|---|---|---|---|
prompt | string | 是 | 一只猫在城市街头奔跑 | 提示词 |
size | string | 否 | 1280x720 | 视频尺寸 |
images | string | 否 | https://example.com/a.png | 参考图地址,多个地址用英文逗号分隔 |
duration | string | 否 | 10 | 视频时长 |
图生视频创建任务
请求地址
POST https://puream.cn/api/ai/video/image-to-video/tasks
请求 Header
| 名称 | 必填 | 说明 |
|---|---|---|
Authorization | 是 | Bearer 你的纯梦 API Key |
Content-Type | 是 | application/json |
请求参数
| 字段 | 类型 | 必填 | 示例 | 说明 |
|---|---|---|---|---|
prompt | string | 是 | 未来感城市夜景 | 提示词 |
images | string | 是 | https://example.com/a.png | 参考图地址,多个地址用英文逗号分隔 |
场景切分
计费:按输入视频时长计费,纯梦价格 0.03 元/分钟。
请求地址
POST https://puream.cn/api/ai/video-tools/scene-split/tasks
请求 Header
| 名称 | 必填 | 说明 |
|---|---|---|
Authorization | 是 | Bearer 你的纯梦 API Key |
Content-Type | 是 | application/json |
请求参数
| 字段 | 类型 | 必填 | 示例 | 说明 |
|---|---|---|---|---|
video_url | string | 是 | https://example.com/media.mp4 | 待处理的视频 URL,需公网可访问 |
segment_threshold | number | 否 | 10 | 场景切分敏感度,取值范围 [0, 100),越低切片越多 |
min_duration | number | 否 | 3 | 单个切片最小时长,单位秒 |
max_duration | number | 否 | 30 | 单个切片最大时长,单位秒 |
enable_clip_fade | boolean | 否 | true | 是否对切片边界做淡入淡出处理 |
callback_url | string | 否 | https://example.com/callback | 任务完成回调地址 |
请求示例
curl -X POST "https://puream.cn/api/ai/video-tools/scene-split/tasks" \
-H "Authorization: Bearer 你的纯梦APIKey" \
-H "Content-Type: application/json" \
-d '{
"video_url": "https://example.com/your_long_video.mp4",
"segment_threshold": 10,
"min_duration": 3,
"max_duration": 30,
"enable_clip_fade": true
}'字幕擦除标准版
计费:按输出视频时长计费,纯梦价格 0.6 元/分钟。
请求地址
POST https://puream.cn/api/ai/video-tools/subtitle-erase-standard/tasks
请求 Header
| 名称 | 必填 | 说明 |
|---|---|---|
Authorization | 是 | Bearer 你的纯梦 API Key |
Content-Type | 是 | application/json |
请求参数
| 字段 | 类型 | 必填 | 示例 | 说明 |
|---|---|---|---|---|
video_url | string | 是 | https://example.com/video.mp4 | 待擦除字幕的视频 URL,需公网可访问 |
callback_url | string | 否 | https://example.com/callback | 任务完成回调地址 |
请求示例
curl -X POST "https://puream.cn/api/ai/video-tools/subtitle-erase-standard/tasks" \
-H "Authorization: Bearer 你的纯梦APIKey" \
-H "Content-Type: application/json" \
-d '{
"video_url": "https://example.com/source_video.mp4"
}'视频调速
计费:按输出视频时长计费,纯梦价格 0.09 元/分钟。
请求地址
POST https://puream.cn/api/ai/video-tools/adjust-video-speed/tasks
请求 Header
| 名称 | 必填 | 说明 |
|---|---|---|
Authorization | 是 | Bearer 你的纯梦 API Key |
Content-Type | 是 | application/json |
请求参数
| 字段 | 类型 | 必填 | 示例 | 说明 |
|---|---|---|---|---|
video_url | string | 是 | https://example.com/video.mp4 | 待调速的视频 URL,需公网可访问 |
speed | number | 是 | 2.0 | 播放倍速,范围 0.1 到 4 |
callback_url | string | 否 | https://example.com/callback | 任务完成回调地址 |
请求示例
curl -X POST "https://puream.cn/api/ai/video-tools/adjust-video-speed/tasks" \
-H "Authorization: Bearer 你的纯梦APIKey" \
-H "Content-Type: application/json" \
-d '{
"video_url": "https://example.com/source_video.mp4",
"speed": 2.0
}'查询任务结果
视频生成查询
GET https://puream.cn/api/ai/video/tasks/任务ID
视频工具查询
GET https://puream.cn/api/ai/video-tools/scene-split/tasks/任务ID
GET https://puream.cn/api/ai/video-tools/subtitle-erase-standard/tasks/任务ID
GET https://puream.cn/api/ai/video-tools/adjust-video-speed/tasks/任务ID
请求 Header
| 名称 | 必填 | 说明 |
|---|---|---|
Authorization | 是 | Bearer 你的纯梦 API Key |
视频工具返回参数
| 字段 | 类型 | 说明 |
|---|---|---|
success | boolean | 任务是否成功 |
task_id | string | 任务 ID |
result.video_url | string | 字幕擦除成功后的视频地址 |
result.duration | number | 视频时长,单位秒 |
result.segments | array | 场景切分片段列表 |
result.segments[].start_time | number | 片段开始时间 |
result.segments[].end_time | number | 片段结束时间 |
result.segments[].segment_video_url | string | 片段视频地址 |
error.message | string | 失败原因 |
轮询建议
视频任务都是异步任务。建议创建任务后每 20 秒查询一次,查询到成功状态和结果地址后直接返回 URL。 如果超过最大等待次数仍未完成,可以返回任务 ID 和当前状态,让用户稍后继续查询。