api-config.json 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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. "currentToken": "r:858b3ee92314d5447d1fc3cdc10462d7",
  145. "resolutionOrder": [
  146. "configFile",
  147. "currentToken"
  148. ],
  149. "apigId": "Vo3ROWEvDy",
  150. "paymentUrlResolution": {
  151. "description": "动态构建充值URL:通过当前token查出用户objectId,拼接到充值页面",
  152. "steps": [
  153. "1. 从 voc-credentials.json 或 currentToken 获取当前 session token",
  154. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  155. "3. 拼接充值URL: https://pwa.fmode.cn/apig-pay.html?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  156. "4. 将该URL展示给用户,引导扫码支付"
  157. ],
  158. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  159. "userResolveHeaders": {
  160. "X-Parse-Application-Id": "ncloudmaster",
  161. "X-Parse-Session-Token": "{vocToken}"
  162. },
  163. "paymentBaseUrl": "https://pwa.fmode.cn/apig-pay.html",
  164. "paymentParams": {
  165. "user": "{resolvedUserId}",
  166. "apigid": "Vo3ROWEvDy",
  167. "fun_id": "HOkkX72PMF"
  168. },
  169. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  170. },
  171. "onMissing": {
  172. "action": "resolveUserThenShowPayment",
  173. "title": "扫码开通 VOC-AI 数据服务",
  174. "message": "此 Skill 需要有效的 API Token。请按以下步骤操作:\n1. 如果你已有 Token,请告诉我,我会保存到 ~/.openclaw/voc-credentials.json\n2. 如果没有 Token,我会引导你扫码充值开通"
  175. },
  176. "onBalanceInsufficient": {
  177. "action": "resolveUserThenShowPayment",
  178. "title": "VOC-AI Token 余额不足,请扫码充值",
  179. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  180. }
  181. },
  182. "errorHandling": {
  183. "balanceInsufficient": {
  184. "conditions": [
  185. {
  186. "responseField": "code",
  187. "operator": "in",
  188. "value": [
  189. -2,
  190. -3,
  191. -10,
  192. 402,
  193. 429
  194. ]
  195. },
  196. {
  197. "responseField": "msg",
  198. "operator": "contains",
  199. "value": [
  200. "余额不足",
  201. "insufficient",
  202. "balance",
  203. "quota"
  204. ]
  205. },
  206. {
  207. "responseField": "message",
  208. "operator": "contains",
  209. "value": [
  210. "余额不足",
  211. "insufficient",
  212. "balance"
  213. ]
  214. }
  215. ],
  216. "matchMode": "any",
  217. "trigger": "tokenConfig.onBalanceInsufficient"
  218. },
  219. "unauthorized": {
  220. "conditions": [
  221. {
  222. "responseField": "code",
  223. "operator": "in",
  224. "value": [
  225. 401,
  226. 403
  227. ]
  228. },
  229. {
  230. "responseField": "msg",
  231. "operator": "contains",
  232. "value": [
  233. "unauthorized",
  234. "token",
  235. "invalid",
  236. "auth"
  237. ]
  238. }
  239. ],
  240. "matchMode": "any",
  241. "trigger": "tokenConfig.onMissing"
  242. }
  243. }
  244. }