api-config.json 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. {
  2. "name": "transcript-to-video",
  3. "displayName": "逐字稿 AI 视频生成工作流",
  4. "description": "输入逐字稿文本,AI 自动拆分分镜脚本,批量生成视频素材,输出视频片段 URL 列表和 SRT 字幕文件。支持文生视频和先图后视频两种模式。",
  5. "category": "video-creation",
  6. "version": "1.0.0",
  7. "type": "orchestration",
  8. "parameters": {
  9. "type": "object",
  10. "required": [
  11. "transcript"
  12. ],
  13. "properties": {
  14. "transcript": {
  15. "type": "string",
  16. "description": "逐字稿全文(中文),Agent 将自动拆分为分镜段"
  17. },
  18. "segmentDuration": {
  19. "type": "number",
  20. "description": "姣忔鐩爣鏃堕暱锛堢锛夛紝褰卞搷鍒嗛暅鎷嗗垎绮掑害",
  21. "default": 15
  22. },
  23. "videoModel": {
  24. "type": "string",
  25. "enum": [
  26. "720p",
  27. "1080p",
  28. "pro"
  29. ],
  30. "description": "瑙嗛鐢熸垚妯″瀷璐ㄩ噺绛夌骇",
  31. "default": "720p"
  32. },
  33. "videoMethod": {
  34. "type": "string",
  35. "enum": [
  36. "text2video",
  37. "img2video"
  38. ],
  39. "description": "text2video=纯文生视频(更快),img2video=先生成图片再图生视频(效果更可控)",
  40. "default": "text2video"
  41. },
  42. "aspectRatio": {
  43. "type": "string",
  44. "enum": [
  45. "16:9",
  46. "9:16",
  47. "1:1",
  48. "4:3",
  49. "3:4",
  50. "21:9"
  51. ],
  52. "description": "瑙嗛鐢婚潰姣斾緥",
  53. "default": "16:9"
  54. },
  55. "frames": {
  56. "type": "integer",
  57. "enum": [
  58. 121,
  59. 241
  60. ],
  61. "description": "视频帧数,121=5秒,241=10秒",
  62. "default": 121
  63. }
  64. }
  65. },
  66. "pipeline": [
  67. {
  68. "step": 1,
  69. "name": "AI鍒嗛暅鑴氭湰鐢熸垚",
  70. "type": "ai",
  71. "description": "Agent灏嗛€愬瓧绋挎媶鍒嗕负鍒嗛暅JSON鍜孲RT瀛楀箷",
  72. "aiConfig": {
  73. "systemPrompt": "你是专业的视频分镜脚本编写专家。请将逐字稿拆分为分镜段,每段约 40-45 个中文字(约 15 秒语速)。为每段生成英文视频提示词(prompt),描述画面内容、镜头类型、氛围和画质。",
  74. "userPromptTemplate": "请将以下逐字稿拆分为分镜脚本,每段约 ${segmentDuration} 秒。\n\n逐字稿:\n${transcript}\n\n请输出 JSON 数组,每项包含 id、act、narration、type、prompt、duration 字段,并同时输出 SRT 字幕文件内容。",
  75. "outputFormat": {
  76. "storyboard": "Array<{id, act, narration, type, prompt, duration}>",
  77. "srt": "String (SRT format subtitle content)"
  78. },
  79. "temperature": 0.3
  80. },
  81. "output": {
  82. "storyboard": "鍒嗛暅JSON鏁扮粍",
  83. "srt": "SRT瀛楀箷鏂囦欢鍐呭"
  84. }
  85. },
  86. {
  87. "step": 2,
  88. "name": "鎵归噺鐢熸垚瑙嗛绱犳潗",
  89. "type": "api",
  90. "description": "瀵规瘡涓垎闀滄骞惰璋冪敤鍗虫ⅵ瑙嗛鐢熸垚API",
  91. "forEach": "storyboard",
  92. "forEachAs": "segment",
  93. "parallel": {
  94. "maxConcurrent": 5,
  95. "delayMs": 1000
  96. },
  97. "branches": {
  98. "text2video": {
  99. "condition": "videoMethod === 'text2video'",
  100. "steps": [
  101. {
  102. "id": "2a",
  103. "name": "鏂囩敓瑙嗛",
  104. "skill": "jimeng/jimeng-video-v3-720p",
  105. "skillVariants": {
  106. "720p": "jimeng/jimeng-video-v3-720p",
  107. "1080p": "jimeng/jimeng-video-v3-1080p",
  108. "pro": "jimeng/jimeng-video-v3-pro"
  109. },
  110. "input": {
  111. "prompt": "${segment.prompt}",
  112. "method": "1",
  113. "frames": "${frames}",
  114. "config": {
  115. "aspect_ratio": "${aspectRatio}"
  116. }
  117. },
  118. "output": "workIds[${segment.id}]"
  119. }
  120. ]
  121. },
  122. "img2video": {
  123. "condition": "videoMethod === 'img2video'",
  124. "steps": [
  125. {
  126. "id": "2b-1",
  127. "name": "文生图(首帧)",
  128. "skill": "jimeng/jimeng-img-v4",
  129. "input": {
  130. "prompt": "${segment.prompt}",
  131. "sizeDate": {
  132. "width": "${aspectRatio === '16:9' ? 2560 : aspectRatio === '9:16' ? 1440 : 2048}",
  133. "height": "${aspectRatio === '16:9' ? 1440 : aspectRatio === '9:16' ? 2560 : 2048}"
  134. }
  135. },
  136. "output": "imageWorkIds[${segment.id}]"
  137. },
  138. {
  139. "id": "2b-2",
  140. "name": "杞鍥剧墖缁撴灉",
  141. "skill": "jimeng/jimeng-task-query",
  142. "dependsOn": [
  143. "2b-1"
  144. ],
  145. "input": {
  146. "workId": "${imageWorkIds[segment.id]}",
  147. "routerName": "getImgV4"
  148. },
  149. "pollingConfig": {
  150. "intervalMs": 3000,
  151. "maxAttempts": 30,
  152. "completionCondition": "data.isFinish === true"
  153. }
  154. },
  155. {
  156. "id": "2b-3",
  157. "name": "鑾峰彇鍥剧墖URL",
  158. "skill": "jimeng/jimeng-work-result",
  159. "dependsOn": [
  160. "2b-2"
  161. ],
  162. "input": {
  163. "workId": "${imageWorkIds[segment.id]}"
  164. },
  165. "output": "imageUrls[${segment.id}]",
  166. "responseExtract": "images[0]"
  167. },
  168. {
  169. "id": "2b-4",
  170. "name": "鍥剧敓瑙嗛锛堥甯э級",
  171. "skill": "jimeng/jimeng-video-v3-720p",
  172. "dependsOn": [
  173. "2b-3"
  174. ],
  175. "input": {
  176. "prompt": "${segment.prompt}",
  177. "method": "2",
  178. "frames": "${frames}",
  179. "config": {
  180. "image_urls": [
  181. "${imageUrls[segment.id]}"
  182. ]
  183. }
  184. },
  185. "output": "workIds[${segment.id}]"
  186. }
  187. ]
  188. }
  189. }
  190. },
  191. {
  192. "step": 3,
  193. "name": "杞瑙嗛鐢熸垚缁撴灉",
  194. "type": "api",
  195. "forEach": "workIds",
  196. "forEachAs": "workId",
  197. "parallel": {
  198. "maxConcurrent": 10,
  199. "delayMs": 500
  200. },
  201. "steps": [
  202. {
  203. "id": "3a",
  204. "name": "轮询任务状态",
  205. "skill": "jimeng/jimeng-task-query",
  206. "input": {
  207. "workId": "${workId}",
  208. "routerName": "${videoModel === '720p' ? 'getVideoV3_720p' : videoModel === '1080p' ? 'getVideoV3_1080p' : 'getVideoV3_Pro'}"
  209. },
  210. "pollingConfig": {
  211. "intervalMs": 5000,
  212. "maxAttempts": 60,
  213. "completionCondition": "data.isFinish === true",
  214. "timeoutMs": 300000
  215. }
  216. },
  217. {
  218. "id": "3b",
  219. "name": "鑾峰彇瑙嗛URL",
  220. "skill": "jimeng/jimeng-work-result",
  221. "dependsOn": [
  222. "3a"
  223. ],
  224. "input": {
  225. "workId": "${workId}"
  226. },
  227. "output": "videoResults[${segmentId}]",
  228. "responseExtract": {
  229. "videoUrl": "videos[0]",
  230. "images": "images"
  231. }
  232. }
  233. ]
  234. },
  235. {
  236. "step": 4,
  237. "name": "结果汇总",
  238. "type": "compute",
  239. "logic": "aggregateResults(storyboard, srt, videoResults)",
  240. "algorithm": {
  241. "merge": "灏嗗垎闀淛SON涓庤棰慤RL鍚堝苟",
  242. "stats": "缁熻鎴愬姛/澶辫触鏁伴噺",
  243. "failedRetry": "澶辫触鐨勫垎闀滄鏍囪涓篺ailedIds锛屽彲閲嶈瘯"
  244. },
  245. "output": "finalOutput"
  246. },
  247. {
  248. "step": 5,
  249. "name": "可选:一键成片",
  250. "type": "api",
  251. "optional": true,
  252. "condition": "user requests quick compilation && successCount <= 50 && totalDuration <= 30",
  253. "skill": "video-creation/quickly-video-create",
  254. "input": {
  255. "material_list": "${videoResults.map(r => ({ type: 'video', value: r.videoUrl }))}",
  256. "tags": "${extractKeywords(transcript)}",
  257. "proportion": "${aspectRatio === '9:16' ? '9:16' : aspectRatio === '1:1' ? '1:1' : '9:16'}",
  258. "video_duration": {
  259. "min": 15,
  260. "max": 30
  261. },
  262. "pre_id": "${Date.now().toString()}",
  263. "ai_voice": 1,
  264. "ai_bgm": 1,
  265. "ai_subtitle": 1
  266. },
  267. "output": "quicklyTaskId",
  268. "downstream": "video-creation/quickly-video-query"
  269. }
  270. ],
  271. "response": {
  272. "type": "object",
  273. "properties": {
  274. "storyboard": {
  275. "type": "array",
  276. "description": "鍒嗛暅鑴氭湰JSON",
  277. "items": {
  278. "type": "object",
  279. "properties": {
  280. "id": {
  281. "type": "string"
  282. },
  283. "act": {
  284. "type": "string"
  285. },
  286. "narration": {
  287. "type": "string"
  288. },
  289. "prompt": {
  290. "type": "string"
  291. },
  292. "duration": {
  293. "type": "string"
  294. },
  295. "videoUrl": {
  296. "type": "string",
  297. "description": "鐢熸垚鐨勮棰慤RL锛堟案涔呮湁鏁堬級"
  298. },
  299. "imageUrl": {
  300. "type": "string",
  301. "description": "生成的首帧图片 URL(img2video 模式)"
  302. }
  303. }
  304. }
  305. },
  306. "srt": {
  307. "type": "string",
  308. "description": "SRT瀛楀箷鏂囦欢鍐呭"
  309. },
  310. "segments": {
  311. "type": "array",
  312. "description": "视频片段汇总",
  313. "items": {
  314. "type": "object",
  315. "properties": {
  316. "id": {
  317. "type": "string"
  318. },
  319. "videoUrl": {
  320. "type": "string"
  321. },
  322. "duration": {
  323. "type": "number"
  324. },
  325. "prompt": {
  326. "type": "string"
  327. }
  328. }
  329. }
  330. },
  331. "totalSegments": {
  332. "type": "integer"
  333. },
  334. "successCount": {
  335. "type": "integer"
  336. },
  337. "failedCount": {
  338. "type": "integer"
  339. },
  340. "failedIds": {
  341. "type": "array",
  342. "items": {
  343. "type": "string"
  344. }
  345. }
  346. }
  347. },
  348. "relatedSkills": [
  349. "jimeng/jimeng-video-v3-720p",
  350. "jimeng/jimeng-video-v3-1080p",
  351. "jimeng/jimeng-video-v3-pro",
  352. "jimeng/jimeng-img-v4",
  353. "jimeng/jimeng-task-query",
  354. "jimeng/jimeng-work-result",
  355. "video-creation/quickly-video-create",
  356. "video-creation/quickly-video-query"
  357. ],
  358. "pricing": {
  359. "text2video_720p_5s": {
  360. "perSegment": 1.4,
  361. "unit": "CNY",
  362. "formula": "0.28元/秒 × 5秒"
  363. },
  364. "text2video_720p_10s": {
  365. "perSegment": 2.8,
  366. "unit": "CNY",
  367. "formula": "0.28元/秒 × 10秒"
  368. },
  369. "img2video_720p_5s": {
  370. "perSegment": 1.62,
  371. "unit": "CNY",
  372. "formula": "0.22鍏?鍥? + 0.28鍏?绉捗?绉?瑙嗛)"
  373. },
  374. "example_71segments_5s": {
  375. "text2video": "约99元",
  376. "img2video": "约115元"
  377. }
  378. },
  379. "limitations": {
  380. "videoDuration": "仅支持 5 秒(121 帧)或 10 秒(241 帧),无法精确匹配 SRT 时间戳",
  381. "noTTS": "鏃燭TS閰嶉煶鑳藉姏锛岄渶鐢ㄦ埛鍦ㄥ壀鏄犱腑閰嶉煶",
  382. "noAutoStitch": "暂无自动拼接长视频能力,quickly 最长 30 秒",
  383. "parallelLimit": "即梦 API 建议并行数不超过 5,避免触发频率限制"
  384. },
  385. "futureExtensions": [
  386. {
  387. "name": "tts-voiceover",
  388. "description": "TTS 配音 Skill:按逐字稿生成语音音频",
  389. "status": "planned"
  390. },
  391. {
  392. "name": "video-stitch",
  393. "description": "视频拼接 Skill:FFmpeg 服务端按 SRT 时间轴精确拼接",
  394. "status": "planned"
  395. },
  396. {
  397. "name": "seeddance-video",
  398. "description": "seeddance2.0 模型接入:生成更高质量视频",
  399. "status": "planned"
  400. }
  401. ],
  402. "tokenConfig": {
  403. "type": "bearer",
  404. "configFile": "~/.openclaw/voc-credentials.json",
  405. "tokenField": "vocToken",
  406. "resolutionOrder": [
  407. "configFile"
  408. ],
  409. "apigId": "Vo3ROWEvDy",
  410. "paymentUrlResolution": {
  411. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  412. "steps": [
  413. "1. 从 voc-credentials.json 获取当前 session token",
  414. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  415. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  416. "4. 将该URL展示给用户,引导扫码支付"
  417. ],
  418. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  419. "userResolveHeaders": {
  420. "X-Parse-Application-Id": "ncloudmaster",
  421. "X-Parse-Session-Token": "{vocToken}"
  422. },
  423. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  424. "paymentParams": {
  425. "user": "{resolvedUserId}",
  426. "apigid": "Vo3ROWEvDy",
  427. "fun_id": "HOkkX72PMF"
  428. },
  429. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  430. },
  431. "onMissing": {
  432. "action": "showPaymentQR",
  433. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  434. "title": "扫码开通 VOC-AI 数据服务",
  435. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  436. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  437. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  438. },
  439. "onBalanceInsufficient": {
  440. "action": "resolveUserThenShowPayment",
  441. "title": "VOC-AI Token 余额不足,请扫码充值",
  442. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  443. }
  444. },
  445. "errorHandling": {
  446. "balanceInsufficient": {
  447. "conditions": [
  448. {
  449. "responseField": "code",
  450. "operator": "in",
  451. "value": [
  452. -2,
  453. -3,
  454. -10,
  455. 402,
  456. 429
  457. ]
  458. },
  459. {
  460. "responseField": "msg",
  461. "operator": "contains",
  462. "value": [
  463. "余额不足",
  464. "insufficient",
  465. "balance",
  466. "quota",
  467. "没有开通",
  468. "权限或余额"
  469. ]
  470. },
  471. {
  472. "responseField": "mess",
  473. "operator": "contains",
  474. "value": [
  475. "余额不足",
  476. "insufficient",
  477. "balance",
  478. "quota",
  479. "没有开通",
  480. "权限或余额"
  481. ]
  482. },
  483. {
  484. "responseField": "message",
  485. "operator": "contains",
  486. "value": [
  487. "余额不足",
  488. "insufficient",
  489. "balance",
  490. "没有开通",
  491. "权限或余额"
  492. ]
  493. }
  494. ],
  495. "matchMode": "any",
  496. "trigger": "tokenConfig.onBalanceInsufficient"
  497. },
  498. "unauthorized": {
  499. "conditions": [
  500. {
  501. "responseField": "code",
  502. "operator": "in",
  503. "value": [
  504. 401,
  505. 403
  506. ]
  507. },
  508. {
  509. "responseField": "msg",
  510. "operator": "contains",
  511. "value": [
  512. "unauthorized",
  513. "token",
  514. "invalid",
  515. "auth"
  516. ]
  517. }
  518. ],
  519. "matchMode": "any",
  520. "trigger": "tokenConfig.onMissing"
  521. }
  522. },
  523. "timeout": 600000,
  524. "retry": {
  525. "maxAttempts": 2,
  526. "delay": 3000,
  527. "backoffMultiplier": 2
  528. }
  529. }