api-config.json 6.3 KB

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