API 接入指南
视频去字幕与去水印
提交视频净化任务并获取处理后的视频。
POST /api-platform/v1/video/remove-subtitles 未传 region 时识别字幕,传入时处理指定矩形。POST /api-platform/v1/video/remove-watermark 必须指定一个固定矩形。坐标为原始编码视频的整数像素,要求 x2 > x1、y2 > y1,且区域不能超出画面。首期不支持移动水印或多区域。
| 参数 | 说明 |
|---|---|
videoUrl | 公网 HTTP(S) 视频直链,最大 200 MiB、最长 600 秒 |
engine | base(默认)或 pro |
method | 仅 BASE:inpaint(默认无损擦除)或 blur(模糊遮挡);PRO 不能传 |
region | {x1,y1,x2,y2};去字幕可选,去水印必填 |
上传前归一化旋转信息。PRO 要求 MP4 容器,短边不超过 1080 像素,并需配置服务端上传。后端探测真实时长,按 30 秒单位向上取整及当前 API 价格计费。工具 API 介绍计费、幂等、上传和轮询。
curl 'https://aihub-admin.aimix.pro/api-platform/v1/video/remove-watermark' \
-H "Authorization: Bearer $PIXMIND_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cleanup-order-001' \
-d '{"videoUrl":"https://example.com/input.mp4","engine":"base","method":"inpaint","region":{"x1":100,"y1":80,"x2":420,"y2":180}}'const response = await fetch("https://aihub-admin.aimix.pro/api-platform/v1/video/remove-subtitles", {
method: "POST", headers: {Authorization: `Bearer ${process.env.PIXMIND_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": "cleanup-order-002"},
body: JSON.stringify({videoUrl: "https://example.com/input.mp4", engine: "base", method: "inpaint"})
});
const created = await response.json();
if (!response.ok || created.code !== 1000) throw new Error(created.message);
console.log(created.data.taskId, created.data.statusUrl);import os, requests
response = requests.post("https://aihub-admin.aimix.pro/api-platform/v1/video/remove-subtitles",
headers={"Authorization": "Bearer " + os.environ["PIXMIND_API_KEY"], "Idempotency-Key": "cleanup-order-003"},
json={"videoUrl": "https://example.com/input.mp4", "engine": "base", "method": "inpaint"}, timeout=30)
response.raise_for_status()
created = response.json()
if created["code"] != 1000: raise RuntimeError(created["message"])
print(created["data"])创建成功的 data 包含 {taskId,status:"processing",type,model,statusUrl}。查询 GET /api-platform/v1/video/cleanup/tasks/{taskId}。成功终态返回 status:"ready"、videoUrl、progress 和 usage:{credits,units,refunded};失败终态返回 status:"failed"、error:{code,message},已扣费任务按原 API 流水退款。