api-config.json 6.1 KB

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