api-config.json 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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": "body",
  142. "tokenField": "token",
  143. "format": "Bearer r:{{jimengToken}}",
  144. "configFile": "~/.openclaw/voc-credentials.json",
  145. "currentToken": "r:f0333969e312a40e4703e8fe4ed1c600",
  146. "resolutionOrder": [
  147. "configFile",
  148. "currentToken"
  149. ],
  150. "onMissing": {
  151. "action": "showPaymentQR",
  152. "qrCodeUrl": "https://pwa.fmode.cn/apig-pay.html?user={{user}}&apigid={{apigid}}&fun_id=HOkkX72PMF",
  153. "paymentCheckEndpoint": "https://server.fmode.cn/api/apig/getApig",
  154. "pollingIntervalMs": 3000,
  155. "pollingTimeoutMs": 300000,
  156. "onPaymentSuccess": "retrySkillWithNewToken",
  157. "title": "扫码开通即梦AI生成服务",
  158. "message": "请扫描下方二维码完成支付,支付成功后将自动获取 Token 并继续执行。"
  159. },
  160. "onBalanceInsufficient": {
  161. "action": "showPaymentQR",
  162. "qrCodeUrl": "https://pwa.fmode.cn/apig-pay.html?user={{user}}&apigid={{apigid}}&fun_id=HOkkX72PMF",
  163. "paymentCheckEndpoint": "https://server.fmode.cn/api/apig/getApig",
  164. "pollingIntervalMs": 3000,
  165. "pollingTimeoutMs": 300000,
  166. "onPaymentSuccess": "retrySkillWithNewToken",
  167. "title": "即梦AI Token 余额不足,请扫码充值",
  168. "message": "当前 Token 余额不足,请扫描二维码充值,支付完成后将自动继续执行。"
  169. }
  170. },
  171. "errorHandling": {
  172. "balanceInsufficient": {
  173. "conditions": [
  174. {
  175. "responseField": "code",
  176. "operator": "in",
  177. "value": [
  178. -2,
  179. -3,
  180. -10,
  181. 402,
  182. 429
  183. ]
  184. },
  185. {
  186. "responseField": "msg",
  187. "operator": "contains",
  188. "value": [
  189. "余额不足",
  190. "insufficient",
  191. "balance",
  192. "quota"
  193. ]
  194. },
  195. {
  196. "responseField": "message",
  197. "operator": "contains",
  198. "value": [
  199. "余额不足",
  200. "insufficient",
  201. "balance"
  202. ]
  203. }
  204. ],
  205. "matchMode": "any",
  206. "trigger": "tokenConfig.onBalanceInsufficient"
  207. },
  208. "unauthorized": {
  209. "conditions": [
  210. {
  211. "responseField": "code",
  212. "operator": "in",
  213. "value": [
  214. 401,
  215. 403
  216. ]
  217. },
  218. {
  219. "responseField": "msg",
  220. "operator": "contains",
  221. "value": [
  222. "unauthorized",
  223. "token",
  224. "invalid",
  225. "auth"
  226. ]
  227. }
  228. ],
  229. "matchMode": "any",
  230. "trigger": "tokenConfig.onMissing"
  231. }
  232. }
  233. }