api-config.json 5.9 KB

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