api-config.json 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. {
  2. "name": "jimeng-inpaint",
  3. "displayName": "交互编辑(局部重绘/消除笔)",
  4. "description": "通过涂抹选区建立重绘区域,支持局部重绘和消除笔功能。",
  5. "category": "jimeng",
  6. "version": "1.0.0",
  7. "endpoint": {
  8. "method": "POST",
  9. "url": "https://server.fmode.cn/api/volcengine/jimeng/getInpaint",
  10. "headers": {
  11. "Content-Type": "application/json"
  12. }
  13. },
  14. "parameters": {
  15. "type": "object",
  16. "required": [
  17. "image_urls",
  18. "prompt",
  19. "token"
  20. ],
  21. "properties": {
  22. "image_urls": {
  23. "type": "array",
  24. "items": {
  25. "type": "string"
  26. },
  27. "description": "图片文件URL,需输入2张(原图+mask图)"
  28. },
  29. "prompt": {
  30. "type": "string",
  31. "description": "提示词,消除场景输入\"删除\",文字修改放在\"\"内"
  32. },
  33. "token": {
  34. "type": "string",
  35. "description": "认证token"
  36. }
  37. }
  38. },
  39. "response": {
  40. "type": "object",
  41. "properties": {
  42. "code": {
  43. "type": "integer"
  44. },
  45. "data": {
  46. "type": "object",
  47. "properties": {
  48. "workId": {
  49. "type": "string"
  50. }
  51. }
  52. }
  53. }
  54. },
  55. "usageExamples": [
  56. {
  57. "name": "局部重绘-替换人物",
  58. "input": {
  59. "image_urls": [
  60. "https://example.com/original.png",
  61. "https://example.com/mask.png"
  62. ],
  63. "prompt": "将小女孩换成古风仙子",
  64. "token": "Bearer r:xxx"
  65. },
  66. "description": "使用mask标记区域,重绘为古风仙子"
  67. }
  68. ],
  69. "relatedSkills": [
  70. "jimeng-task-query"
  71. ],
  72. "pricing": {
  73. "unit": "次",
  74. "price": 0.2,
  75. "currency": "CNY",
  76. "reference": "https://www.volcengine.com/docs/86081/1660170"
  77. },
  78. "timeout": 30000,
  79. "tokenConfig": {
  80. "type": "bearer",
  81. "configFile": "~/.openclaw/voc-credentials.json",
  82. "tokenField": "vocToken",
  83. "resolutionOrder": [
  84. "configFile"
  85. ],
  86. "apigId": "Vo3ROWEvDy",
  87. "paymentUrlResolution": {
  88. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  89. "steps": [
  90. "1. 从 voc-credentials.json 获取当前 session token",
  91. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  92. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  93. "4. 将该URL展示给用户,引导扫码支付"
  94. ],
  95. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  96. "userResolveHeaders": {
  97. "X-Parse-Application-Id": "ncloudmaster",
  98. "X-Parse-Session-Token": "{vocToken}"
  99. },
  100. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  101. "paymentParams": {
  102. "user": "{resolvedUserId}",
  103. "apigid": "Vo3ROWEvDy",
  104. "fun_id": "HOkkX72PMF"
  105. },
  106. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  107. },
  108. "onMissing": {
  109. "action": "showPaymentQR",
  110. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  111. "title": "扫码开通 VOC-AI 数据服务",
  112. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  113. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  114. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  115. },
  116. "onBalanceInsufficient": {
  117. "action": "resolveUserThenShowPayment",
  118. "title": "VOC-AI Token 余额不足,请扫码充值",
  119. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  120. }
  121. },
  122. "errorHandling": {
  123. "balanceInsufficient": {
  124. "conditions": [
  125. {
  126. "responseField": "code",
  127. "operator": "in",
  128. "value": [
  129. -2,
  130. -3,
  131. -10,
  132. 402,
  133. 429
  134. ]
  135. },
  136. {
  137. "responseField": "msg",
  138. "operator": "contains",
  139. "value": [
  140. "余额不足",
  141. "insufficient",
  142. "balance",
  143. "quota",
  144. "没有开通",
  145. "权限或余额"
  146. ]
  147. },
  148. {
  149. "responseField": "mess",
  150. "operator": "contains",
  151. "value": [
  152. "余额不足",
  153. "insufficient",
  154. "balance",
  155. "quota",
  156. "没有开通",
  157. "权限或余额"
  158. ]
  159. },
  160. {
  161. "responseField": "message",
  162. "operator": "contains",
  163. "value": [
  164. "余额不足",
  165. "insufficient",
  166. "balance",
  167. "没有开通",
  168. "权限或余额"
  169. ]
  170. }
  171. ],
  172. "matchMode": "any",
  173. "trigger": "tokenConfig.onBalanceInsufficient"
  174. },
  175. "unauthorized": {
  176. "conditions": [
  177. {
  178. "responseField": "code",
  179. "operator": "in",
  180. "value": [
  181. 401,
  182. 403
  183. ]
  184. },
  185. {
  186. "responseField": "msg",
  187. "operator": "contains",
  188. "value": [
  189. "unauthorized",
  190. "token",
  191. "invalid",
  192. "auth"
  193. ]
  194. }
  195. ],
  196. "matchMode": "any",
  197. "trigger": "tokenConfig.onMissing"
  198. }
  199. }
  200. }