api-config.json 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. {
  2. "name": "jimeng-clothes-v2",
  3. "displayName": "图片换装V2",
  4. "description": "输入模特图和上装/下装图URL,智能完成虚拟换装。",
  5. "category": "jimeng",
  6. "version": "1.0.0",
  7. "endpoint": {
  8. "method": "POST",
  9. "url": "https://server.fmode.cn/api/volcengine/jimeng/getClothesV2",
  10. "headers": {
  11. "Content-Type": "application/json"
  12. }
  13. },
  14. "parameters": {
  15. "type": "object",
  16. "required": [
  17. "model",
  18. "token"
  19. ],
  20. "properties": {
  21. "model": {
  22. "type": "string",
  23. "description": "模特图URL"
  24. },
  25. "upper": {
  26. "type": "string",
  27. "description": "上装图URL(与bottom至少提供一个)"
  28. },
  29. "bottom": {
  30. "type": "string",
  31. "description": "下装图URL(与upper至少提供一个)"
  32. },
  33. "inference_config": {
  34. "type": "object",
  35. "description": "推理配置参数",
  36. "properties": {
  37. "do_sr": {
  38. "type": "boolean",
  39. "default": false
  40. },
  41. "seed": {
  42. "type": "number",
  43. "default": -1
  44. },
  45. "keep_head": {
  46. "type": "boolean",
  47. "default": true
  48. },
  49. "keep_hand": {
  50. "type": "boolean",
  51. "default": false
  52. },
  53. "keep_foot": {
  54. "type": "boolean",
  55. "default": false
  56. },
  57. "num_steps": {
  58. "type": "number",
  59. "default": 16
  60. },
  61. "keep_upper": {
  62. "type": "boolean",
  63. "default": false
  64. },
  65. "keep_lower": {
  66. "type": "boolean",
  67. "default": false
  68. },
  69. "tight_mask": {
  70. "type": "string",
  71. "default": "loose",
  72. "enum": [
  73. "tight",
  74. "loose",
  75. "bbox"
  76. ]
  77. },
  78. "p_bbox_iou_ratio": {
  79. "type": "number",
  80. "default": 0.3
  81. },
  82. "p_bbox_expand_ratio": {
  83. "type": "number",
  84. "default": 1.1
  85. },
  86. "max_process_side_length": {
  87. "type": "number",
  88. "default": 1920
  89. }
  90. }
  91. },
  92. "token": {
  93. "type": "string",
  94. "description": "认证token"
  95. }
  96. }
  97. },
  98. "response": {
  99. "type": "object",
  100. "properties": {
  101. "code": {
  102. "type": "integer"
  103. },
  104. "data": {
  105. "type": "object",
  106. "properties": {
  107. "workId": {
  108. "type": "string"
  109. }
  110. }
  111. }
  112. }
  113. },
  114. "usageExamples": [
  115. {
  116. "name": "模特换上装+下装",
  117. "input": {
  118. "model": "https://example.com/model.jpg",
  119. "upper": "https://example.com/shirt.png",
  120. "bottom": "https://example.com/pants.jpg",
  121. "inference_config": {
  122. "keep_head": true,
  123. "num_steps": 16,
  124. "tight_mask": "loose"
  125. },
  126. "token": "Bearer r:xxx"
  127. },
  128. "description": "为模特换上新的上装和下装"
  129. }
  130. ],
  131. "relatedSkills": [
  132. "jimeng-task-query",
  133. "jimeng-img-v4-goods"
  134. ],
  135. "timeout": 30000,
  136. "tokenConfig": {
  137. "type": "bearer",
  138. "configFile": "~/.openclaw/voc-credentials.json",
  139. "tokenField": "vocToken",
  140. "resolutionOrder": [
  141. "configFile"
  142. ],
  143. "apigId": "Vo3ROWEvDy",
  144. "paymentUrlResolution": {
  145. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  146. "steps": [
  147. "1. 从 voc-credentials.json 获取当前 session token",
  148. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  149. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  150. "4. 将该URL展示给用户,引导扫码支付"
  151. ],
  152. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  153. "userResolveHeaders": {
  154. "X-Parse-Application-Id": "ncloudmaster",
  155. "X-Parse-Session-Token": "{vocToken}"
  156. },
  157. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  158. "paymentParams": {
  159. "user": "{resolvedUserId}",
  160. "apigid": "Vo3ROWEvDy",
  161. "fun_id": "HOkkX72PMF"
  162. },
  163. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  164. },
  165. "onMissing": {
  166. "action": "showPaymentQR",
  167. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  168. "title": "扫码开通 VOC-AI 数据服务",
  169. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  170. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  171. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  172. },
  173. "onBalanceInsufficient": {
  174. "action": "resolveUserThenShowPayment",
  175. "title": "VOC-AI Token 余额不足,请扫码充值",
  176. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  177. }
  178. },
  179. "errorHandling": {
  180. "balanceInsufficient": {
  181. "conditions": [
  182. {
  183. "responseField": "code",
  184. "operator": "in",
  185. "value": [
  186. -2,
  187. -3,
  188. -10,
  189. 402,
  190. 429
  191. ]
  192. },
  193. {
  194. "responseField": "msg",
  195. "operator": "contains",
  196. "value": [
  197. "余额不足",
  198. "insufficient",
  199. "balance",
  200. "quota",
  201. "没有开通",
  202. "权限或余额"
  203. ]
  204. },
  205. {
  206. "responseField": "mess",
  207. "operator": "contains",
  208. "value": [
  209. "余额不足",
  210. "insufficient",
  211. "balance",
  212. "quota",
  213. "没有开通",
  214. "权限或余额"
  215. ]
  216. },
  217. {
  218. "responseField": "message",
  219. "operator": "contains",
  220. "value": [
  221. "余额不足",
  222. "insufficient",
  223. "balance",
  224. "没有开通",
  225. "权限或余额"
  226. ]
  227. }
  228. ],
  229. "matchMode": "any",
  230. "trigger": "tokenConfig.onBalanceInsufficient"
  231. },
  232. "unauthorized": {
  233. "conditions": [
  234. {
  235. "responseField": "code",
  236. "operator": "in",
  237. "value": [
  238. 401,
  239. 403
  240. ]
  241. },
  242. {
  243. "responseField": "msg",
  244. "operator": "contains",
  245. "value": [
  246. "unauthorized",
  247. "token",
  248. "invalid",
  249. "auth"
  250. ]
  251. }
  252. ],
  253. "matchMode": "any",
  254. "trigger": "tokenConfig.onMissing"
  255. }
  256. }
  257. }