api-config.json 5.4 KB

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