第 06 章
U0001F50C后端 API 与 AI 推送
进阶
面向开发者/AI。后端=视频工作台(FastAPI+SQLite+ffmpeg,代码位于 Cloud/allgt-worker/video-workbench/app.py),默认 :8095(当前未在运行,需时用 start.bat 启动),交互文档 /docs。
| 方法 | 路径 | 用途 |
|---|---|---|
| POST | /api/spaces | 创建空间(支持 urls 批量拉取,返回 6 位空间码,编辑页 /s/{code}) |
| GET | /api/spaces/{code} | 读取空间与素材/时间线 |
| PATCH | /api/spaces/{code} | 改标题 |
| DELETE | /api/spaces/{code} | 删除空间(连带文件) |
| POST | /api/spaces/{code}/clips | 添加素材(文件/URL) |
| DELETE | /api/spaces/{code}/clips/{id} | 删除素材(同步清时间线) |
| PUT | /api/spaces/{code}/timeline | 保存剪切片段 |
| POST | /api/spaces/{code}/export | 导出成片(异步,返回 export_id) |
| GET | /api/spaces/{code}/exports/{id} | 查导出状态(done 后可下载) |
| GET | /api/spaces/{code}/exports/{id}/download | 下载成片 MP4 |
| GET | /api/health | 健康检查(spaces/clips 数,ffmpeg 是否可用) |
AI 推送示例:
curl -X POST http://HOST:8095/api/spaces -H "Content-Type: application/json" -d '{"title":"AI生成视频","urls":["http://.../a.mp4"]}'
返回 code,编辑链接 http://HOST:8095/s/{code}。
本说明书维护接口:
- GET /api/projects/freecut/wiki/tree 页面目录
- POST /api/projects/freecut/wiki/page 创建/更新页面(home/features/api/troubleshooting)