api-config.json 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. {
  2. "name": "jimeng-img-v4-goods",
  3. "displayName": "图片生成4.0-商品提取",
  4. "description": "智能提取商品主体并匹配最佳展示视角,支持服装、鞋包、饰品、家具、日用品。",
  5. "category": "jimeng",
  6. "version": "1.0.0",
  7. "endpoint": {
  8. "method": "POST",
  9. "url": "https://server.fmode.cn/api/volcengine/jimeng/getImgV4_goods",
  10. "headers": {
  11. "Content-Type": "application/json"
  12. }
  13. },
  14. "parameters": {
  15. "type": "object",
  16. "required": [
  17. "image_url",
  18. "token"
  19. ],
  20. "properties": {
  21. "image_url": {
  22. "type": "string",
  23. "description": "图片文件URL"
  24. },
  25. "instruction": {
  26. "type": "integer",
  27. "description": "编辑指令: 1全身衣服 2鞋子 3包包 4沙发 5日用品 6饰品",
  28. "default": 1,
  29. "enum": [
  30. 1,
  31. 2,
  32. 3,
  33. 4,
  34. 5,
  35. 6
  36. ]
  37. },
  38. "sizeDate": {
  39. "type": "object",
  40. "properties": {
  41. "width": {
  42. "type": "integer"
  43. },
  44. "height": {
  45. "type": "integer"
  46. }
  47. }
  48. },
  49. "prompt": {
  50. "type": "string",
  51. "description": "提示词"
  52. },
  53. "token": {
  54. "type": "string",
  55. "description": "认证token"
  56. }
  57. }
  58. },
  59. "response": {
  60. "type": "object",
  61. "properties": {
  62. "code": {
  63. "type": "integer"
  64. },
  65. "data": {
  66. "type": "object",
  67. "properties": {
  68. "workId": {
  69. "type": "string"
  70. }
  71. }
  72. }
  73. }
  74. },
  75. "usageExamples": [
  76. {
  77. "name": "提取模特全身衣服",
  78. "input": {
  79. "image_url": "https://example.com/model.jpg",
  80. "instruction": 1,
  81. "sizeDate": {
  82. "width": 2560,
  83. "height": 1440
  84. },
  85. "token": "Bearer r:xxx"
  86. },
  87. "description": "从模特照片提取全身衣服生成白底平铺图"
  88. }
  89. ],
  90. "relatedSkills": [
  91. "jimeng-task-query",
  92. "jimeng-img-v4-pod",
  93. "jimeng-clothes-v2"
  94. ],
  95. "pricing": {
  96. "unit": "张",
  97. "price": 0.22,
  98. "currency": "CNY",
  99. "reference": "https://www.volcengine.com/docs/85621/1544714"
  100. },
  101. "timeout": 30000,
  102. "tokenConfig": {
  103. "type": "bearer",
  104. "configFile": "~/.openclaw/voc-credentials.json",
  105. "tokenField": "vocToken",
  106. "resolutionOrder": [
  107. "configFile"
  108. ],
  109. "apigId": "Vo3ROWEvDy",
  110. "paymentUrlResolution": {
  111. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  112. "steps": [
  113. "1. 从 voc-credentials.json 获取当前 session token",
  114. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  115. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  116. "4. 将该URL展示给用户,引导扫码支付"
  117. ],
  118. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  119. "userResolveHeaders": {
  120. "X-Parse-Application-Id": "ncloudmaster",
  121. "X-Parse-Session-Token": "{vocToken}"
  122. },
  123. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  124. "paymentParams": {
  125. "user": "{resolvedUserId}",
  126. "apigid": "Vo3ROWEvDy",
  127. "fun_id": "HOkkX72PMF"
  128. },
  129. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  130. },
  131. "onMissing": {
  132. "action": "showPaymentQR",
  133. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  134. "title": "扫码开通 VOC-AI 数据服务",
  135. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  136. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  137. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  138. },
  139. "onBalanceInsufficient": {
  140. "action": "resolveUserThenShowPayment",
  141. "title": "VOC-AI Token 余额不足,请扫码充值",
  142. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  143. }
  144. },
  145. "errorHandling": {
  146. "balanceInsufficient": {
  147. "conditions": [
  148. {
  149. "responseField": "code",
  150. "operator": "in",
  151. "value": [
  152. -2,
  153. -3,
  154. -10,
  155. 402,
  156. 429
  157. ]
  158. },
  159. {
  160. "responseField": "msg",
  161. "operator": "contains",
  162. "value": [
  163. "余额不足",
  164. "insufficient",
  165. "balance",
  166. "quota",
  167. "没有开通",
  168. "权限或余额"
  169. ]
  170. },
  171. {
  172. "responseField": "mess",
  173. "operator": "contains",
  174. "value": [
  175. "余额不足",
  176. "insufficient",
  177. "balance",
  178. "quota",
  179. "没有开通",
  180. "权限或余额"
  181. ]
  182. },
  183. {
  184. "responseField": "message",
  185. "operator": "contains",
  186. "value": [
  187. "余额不足",
  188. "insufficient",
  189. "balance",
  190. "没有开通",
  191. "权限或余额"
  192. ]
  193. }
  194. ],
  195. "matchMode": "any",
  196. "trigger": "tokenConfig.onBalanceInsufficient"
  197. },
  198. "unauthorized": {
  199. "conditions": [
  200. {
  201. "responseField": "code",
  202. "operator": "in",
  203. "value": [
  204. 401,
  205. 403
  206. ]
  207. },
  208. {
  209. "responseField": "msg",
  210. "operator": "contains",
  211. "value": [
  212. "unauthorized",
  213. "token",
  214. "invalid",
  215. "auth"
  216. ]
  217. }
  218. ],
  219. "matchMode": "any",
  220. "trigger": "tokenConfig.onMissing"
  221. }
  222. }
  223. }