api-config.json 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. "currentToken": "r:858b3ee92314d5447d1fc3cdc10462d7",
  84. "resolutionOrder": [
  85. "configFile",
  86. "currentToken"
  87. ],
  88. "apigId": "Vo3ROWEvDy",
  89. "paymentUrlResolution": {
  90. "description": "动态构建充值URL:通过当前token查出用户objectId,拼接到充值页面",
  91. "steps": [
  92. "1. 从 voc-credentials.json 或 currentToken 获取当前 session token",
  93. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  94. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  95. "4. 将该URL展示给用户,引导扫码支付"
  96. ],
  97. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  98. "userResolveHeaders": {
  99. "X-Parse-Application-Id": "ncloudmaster",
  100. "X-Parse-Session-Token": "{vocToken}"
  101. },
  102. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  103. "paymentParams": {
  104. "user": "{resolvedUserId}",
  105. "apigid": "Vo3ROWEvDy",
  106. "fun_id": "HOkkX72PMF"
  107. },
  108. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  109. },
  110. "onMissing": {
  111. "action": "resolveUserThenShowPayment",
  112. "title": "扫码开通 VOC-AI 数据服务",
  113. "message": "此 Skill 需要有效的 API Token。请按以下步骤操作:\n1. 如果你已有 Token,请告诉我,我会保存到 ~/.openclaw/voc-credentials.json\n2. 如果没有 Token,我会引导你扫码充值开通"
  114. },
  115. "onBalanceInsufficient": {
  116. "action": "resolveUserThenShowPayment",
  117. "title": "VOC-AI Token 余额不足,请扫码充值",
  118. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  119. }
  120. },
  121. "errorHandling": {
  122. "balanceInsufficient": {
  123. "conditions": [
  124. {
  125. "responseField": "code",
  126. "operator": "in",
  127. "value": [
  128. -2,
  129. -3,
  130. -10,
  131. 402,
  132. 429
  133. ]
  134. },
  135. {
  136. "responseField": "msg",
  137. "operator": "contains",
  138. "value": [
  139. "余额不足",
  140. "insufficient",
  141. "balance",
  142. "quota"
  143. ]
  144. },
  145. {
  146. "responseField": "message",
  147. "operator": "contains",
  148. "value": [
  149. "余额不足",
  150. "insufficient",
  151. "balance"
  152. ]
  153. }
  154. ],
  155. "matchMode": "any",
  156. "trigger": "tokenConfig.onBalanceInsufficient"
  157. },
  158. "unauthorized": {
  159. "conditions": [
  160. {
  161. "responseField": "code",
  162. "operator": "in",
  163. "value": [
  164. 401,
  165. 403
  166. ]
  167. },
  168. {
  169. "responseField": "msg",
  170. "operator": "contains",
  171. "value": [
  172. "unauthorized",
  173. "token",
  174. "invalid",
  175. "auth"
  176. ]
  177. }
  178. ],
  179. "matchMode": "any",
  180. "trigger": "tokenConfig.onMissing"
  181. }
  182. }
  183. }