api-config.json 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. {
  2. "name": "jimeng-img-v4-pod",
  3. "displayName": "图片生成4.0-素材提取(POD)",
  4. "description": "从实物商品中精准提取并矢量化核心图案,生成平面设计图,适用于电商POD场景。",
  5. "category": "jimeng",
  6. "version": "1.0.0",
  7. "endpoint": {
  8. "method": "POST",
  9. "url": "https://server.fmode.cn/api/volcengine/jimeng/getImgV4_pod",
  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提取logo 4提取纹理",
  28. "default": 1,
  29. "enum": [
  30. 1,
  31. 2,
  32. 3,
  33. 4
  34. ]
  35. },
  36. "prompt": {
  37. "type": "string",
  38. "description": "提示词"
  39. },
  40. "lora_weight": {
  41. "type": "number",
  42. "description": "lora权重,范围[0,1],默认1.0",
  43. "default": 1
  44. },
  45. "sizeDate": {
  46. "type": "object",
  47. "properties": {
  48. "width": {
  49. "type": "integer"
  50. },
  51. "height": {
  52. "type": "integer"
  53. }
  54. }
  55. },
  56. "token": {
  57. "type": "string",
  58. "description": "认证token"
  59. }
  60. }
  61. },
  62. "response": {
  63. "type": "object",
  64. "properties": {
  65. "code": {
  66. "type": "integer"
  67. },
  68. "data": {
  69. "type": "object",
  70. "properties": {
  71. "workId": {
  72. "type": "string"
  73. }
  74. }
  75. }
  76. }
  77. },
  78. "usageExamples": [
  79. {
  80. "name": "提取刺绣图案并调色",
  81. "input": {
  82. "image_url": "https://example.com/embroidery.jpg",
  83. "instruction": 1,
  84. "prompt": "改成淡紫色的花朵,深绿色的枝叶",
  85. "lora_weight": 0.5,
  86. "sizeDate": {
  87. "width": 2048,
  88. "height": 2048
  89. },
  90. "token": "Bearer r:xxx"
  91. },
  92. "description": "从刺绣图片提取图案并修改颜色"
  93. }
  94. ],
  95. "relatedSkills": [
  96. "jimeng-task-query",
  97. "jimeng-img-v4-goods"
  98. ],
  99. "pricing": {
  100. "unit": "张",
  101. "price": 0.22,
  102. "currency": "CNY",
  103. "reference": "https://www.volcengine.com/docs/85621/1544714"
  104. },
  105. "timeout": 30000,
  106. "tokenConfig": {
  107. "type": "bearer",
  108. "configFile": "~/.openclaw/voc-credentials.json",
  109. "tokenField": "vocToken",
  110. "resolutionOrder": [
  111. "configFile"
  112. ],
  113. "apigId": "Vo3ROWEvDy",
  114. "paymentUrlResolution": {
  115. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  116. "steps": [
  117. "1. 从 voc-credentials.json 获取当前 session token",
  118. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  119. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  120. "4. 将该URL展示给用户,引导扫码支付"
  121. ],
  122. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  123. "userResolveHeaders": {
  124. "X-Parse-Application-Id": "ncloudmaster",
  125. "X-Parse-Session-Token": "{vocToken}"
  126. },
  127. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  128. "paymentParams": {
  129. "user": "{resolvedUserId}",
  130. "apigid": "Vo3ROWEvDy",
  131. "fun_id": "HOkkX72PMF"
  132. },
  133. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  134. },
  135. "onMissing": {
  136. "action": "showPaymentQR",
  137. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  138. "title": "扫码开通 VOC-AI 数据服务",
  139. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  140. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  141. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  142. },
  143. "onBalanceInsufficient": {
  144. "action": "resolveUserThenShowPayment",
  145. "title": "VOC-AI Token 余额不足,请扫码充值",
  146. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  147. }
  148. },
  149. "errorHandling": {
  150. "balanceInsufficient": {
  151. "conditions": [
  152. {
  153. "responseField": "code",
  154. "operator": "in",
  155. "value": [
  156. -2,
  157. -3,
  158. -10,
  159. 402,
  160. 429
  161. ]
  162. },
  163. {
  164. "responseField": "msg",
  165. "operator": "contains",
  166. "value": [
  167. "余额不足",
  168. "insufficient",
  169. "balance",
  170. "quota",
  171. "没有开通",
  172. "权限或余额"
  173. ]
  174. },
  175. {
  176. "responseField": "mess",
  177. "operator": "contains",
  178. "value": [
  179. "余额不足",
  180. "insufficient",
  181. "balance",
  182. "quota",
  183. "没有开通",
  184. "权限或余额"
  185. ]
  186. },
  187. {
  188. "responseField": "message",
  189. "operator": "contains",
  190. "value": [
  191. "余额不足",
  192. "insufficient",
  193. "balance",
  194. "没有开通",
  195. "权限或余额"
  196. ]
  197. }
  198. ],
  199. "matchMode": "any",
  200. "trigger": "tokenConfig.onBalanceInsufficient"
  201. },
  202. "unauthorized": {
  203. "conditions": [
  204. {
  205. "responseField": "code",
  206. "operator": "in",
  207. "value": [
  208. 401,
  209. 403
  210. ]
  211. },
  212. {
  213. "responseField": "msg",
  214. "operator": "contains",
  215. "value": [
  216. "unauthorized",
  217. "token",
  218. "invalid",
  219. "auth"
  220. ]
  221. }
  222. ],
  223. "matchMode": "any",
  224. "trigger": "tokenConfig.onMissing"
  225. }
  226. }
  227. }