api-config.json 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. {
  2. "name": "jimeng-task-query",
  3. "displayName": "即梦任务结果查询",
  4. "description": "查询即梦AI生成任务状态,轮询获取图片/视频生成结果,支持所有即梦生成接口的结果查询。",
  5. "category": "jimeng",
  6. "version": "1.0.0",
  7. "endpoint": {
  8. "method": "POST",
  9. "url": "https://server.fmode.cn/api/volcengine/jimeng/getDataByTask02",
  10. "headers": {
  11. "Content-Type": "application/json"
  12. }
  13. },
  14. "parameters": {
  15. "type": "object",
  16. "required": [
  17. "routerName",
  18. "token"
  19. ],
  20. "properties": {
  21. "workId": {
  22. "type": "string",
  23. "description": "ImagineWork数据id,与taskId二选一"
  24. },
  25. "taskId": {
  26. "type": "string",
  27. "description": "任务ID,与workId二选一"
  28. },
  29. "routerName": {
  30. "type": "string",
  31. "description": "对应接口名称,首次获取资源必填",
  32. "enum": [
  33. "getClothesV2",
  34. "getImgByImg",
  35. "getImgV4",
  36. "getText2ImgV3",
  37. "getText2ImgV31",
  38. "getImg2ImgV3",
  39. "getImgV4_pod",
  40. "getImgV4_goods",
  41. "getInpaint",
  42. "getSuperResolution",
  43. "getVideoV3_720p",
  44. "getVideoV3_1080p",
  45. "getVideoV3_Pro",
  46. "getActor",
  47. "getActorV2"
  48. ]
  49. },
  50. "logo_info": {
  51. "type": "object",
  52. "description": "水印信息(选填)",
  53. "properties": {
  54. "add_logo": {
  55. "type": "boolean",
  56. "description": "是否添加水印",
  57. "default": false
  58. },
  59. "position": {
  60. "type": "integer",
  61. "description": "水印位置: 0右下/1左下/2左上/3右上",
  62. "default": 0
  63. },
  64. "language": {
  65. "type": "integer",
  66. "description": "0中文/1英文",
  67. "default": 0
  68. },
  69. "opacity": {
  70. "type": "number",
  71. "description": "不透明度[0,1]",
  72. "default": 1
  73. },
  74. "logo_text_content": {
  75. "type": "string",
  76. "description": "自定义水印文本"
  77. }
  78. }
  79. },
  80. "token": {
  81. "type": "string",
  82. "description": "认证token,格式: Bearer r:xxxxxxxx"
  83. }
  84. }
  85. },
  86. "requestTransform": {
  87. "template": {
  88. "workId": "{{workId}}",
  89. "taskId": "{{taskId}}",
  90. "routerName": "{{routerName}}",
  91. "logo_info": "{{logo_info}}",
  92. "token": "{{token}}"
  93. }
  94. },
  95. "response": {
  96. "type": "object",
  97. "properties": {
  98. "code": {
  99. "type": "integer",
  100. "description": "响应状态码,200表示成功"
  101. },
  102. "data": {
  103. "type": "object",
  104. "properties": {
  105. "tip": {
  106. "type": "string",
  107. "description": "状态提示文字"
  108. },
  109. "isFinish": {
  110. "type": "boolean",
  111. "description": "true表示任务完成"
  112. }
  113. }
  114. }
  115. }
  116. },
  117. "notes": "轮询策略:每3-5秒调用一次,直到 data.isFinish=true。任务完成后查询 ImagineWork 表获取 images/videos 字段。",
  118. "usageExamples": [
  119. {
  120. "name": "查询图片生成任务状态",
  121. "input": {
  122. "workId": "82CC78HNl6",
  123. "routerName": "getImgV4",
  124. "token": "Bearer r:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  125. },
  126. "description": "查询 getImgV4 图片生成任务的完成状态"
  127. }
  128. ],
  129. "pollingConfig": {
  130. "intervalMs": 3000,
  131. "maxAttempts": 60,
  132. "completionCondition": "data.isFinish === true"
  133. },
  134. "timeout": 15000,
  135. "retry": {
  136. "maxAttempts": 3,
  137. "delay": 1000,
  138. "backoffMultiplier": 2
  139. },
  140. "tokenConfig": {
  141. "type": "bearer",
  142. "configFile": "~/.openclaw/voc-credentials.json",
  143. "tokenField": "vocToken",
  144. "resolutionOrder": [
  145. "configFile"
  146. ],
  147. "apigId": "Vo3ROWEvDy",
  148. "paymentUrlResolution": {
  149. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  150. "steps": [
  151. "1. 从 voc-credentials.json 获取当前 session token",
  152. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  153. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  154. "4. 将该URL展示给用户,引导扫码支付"
  155. ],
  156. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  157. "userResolveHeaders": {
  158. "X-Parse-Application-Id": "ncloudmaster",
  159. "X-Parse-Session-Token": "{vocToken}"
  160. },
  161. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  162. "paymentParams": {
  163. "user": "{resolvedUserId}",
  164. "apigid": "Vo3ROWEvDy",
  165. "fun_id": "HOkkX72PMF"
  166. },
  167. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  168. },
  169. "onMissing": {
  170. "action": "showPaymentQR",
  171. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  172. "title": "扫码开通 VOC-AI 数据服务",
  173. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  174. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  175. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  176. },
  177. "onBalanceInsufficient": {
  178. "action": "resolveUserThenShowPayment",
  179. "title": "VOC-AI Token 余额不足,请扫码充值",
  180. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  181. }
  182. },
  183. "errorHandling": {
  184. "balanceInsufficient": {
  185. "conditions": [
  186. {
  187. "responseField": "code",
  188. "operator": "in",
  189. "value": [
  190. -2,
  191. -3,
  192. -10,
  193. 402,
  194. 429
  195. ]
  196. },
  197. {
  198. "responseField": "msg",
  199. "operator": "contains",
  200. "value": [
  201. "余额不足",
  202. "insufficient",
  203. "balance",
  204. "quota",
  205. "没有开通",
  206. "权限或余额"
  207. ]
  208. },
  209. {
  210. "responseField": "mess",
  211. "operator": "contains",
  212. "value": [
  213. "余额不足",
  214. "insufficient",
  215. "balance",
  216. "quota",
  217. "没有开通",
  218. "权限或余额"
  219. ]
  220. },
  221. {
  222. "responseField": "message",
  223. "operator": "contains",
  224. "value": [
  225. "余额不足",
  226. "insufficient",
  227. "balance",
  228. "没有开通",
  229. "权限或余额"
  230. ]
  231. }
  232. ],
  233. "matchMode": "any",
  234. "trigger": "tokenConfig.onBalanceInsufficient"
  235. },
  236. "unauthorized": {
  237. "conditions": [
  238. {
  239. "responseField": "code",
  240. "operator": "in",
  241. "value": [
  242. 401,
  243. 403
  244. ]
  245. },
  246. {
  247. "responseField": "msg",
  248. "operator": "contains",
  249. "value": [
  250. "unauthorized",
  251. "token",
  252. "invalid",
  253. "auth"
  254. ]
  255. }
  256. ],
  257. "matchMode": "any",
  258. "trigger": "tokenConfig.onMissing"
  259. }
  260. }
  261. }