api-config.json 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. {
  2. "name": "jimeng-img-v4",
  3. "displayName": "即梦图片生成4.0",
  4. "description": "即梦4.0图片生成,支持文生图、图像编辑及多图组合生成,单次输入最多10张图像,支持4K超高清输出,一次性输出最多15张内容关联图像。",
  5. "category": "jimeng",
  6. "version": "1.0.0",
  7. "endpoint": {
  8. "method": "POST",
  9. "url": "https://server.fmode.cn/api/volcengine/jimeng/getImgV4",
  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": "提示词,支持中文,描述期望生成的图像内容"
  24. },
  25. "image_urls": {
  26. "type": "array",
  27. "items": {
  28. "type": "string"
  29. },
  30. "description": "图片文件URL列表,支持0至10张图,用于多图组合编辑",
  31. "default": []
  32. },
  33. "sizeDate": {
  34. "type": "object",
  35. "description": "图片尺寸数据,不传则使用默认2048×2048",
  36. "properties": {
  37. "width": {
  38. "type": "integer",
  39. "description": "图片宽,推荐: 1024/2048/2304/2496/2560/4096"
  40. },
  41. "height": {
  42. "type": "integer",
  43. "description": "图片高,推荐: 1024/2048/1728/1664/1440/4096"
  44. }
  45. }
  46. },
  47. "scale": {
  48. "type": "number",
  49. "description": "文本描述影响程度,范围[0,1],默认0.5",
  50. "default": 0.5
  51. },
  52. "force_single": {
  53. "type": "boolean",
  54. "description": "是否强制生成单图,默认false",
  55. "default": false
  56. },
  57. "token": {
  58. "type": "string",
  59. "description": "认证token,格式: Bearer r:xxxxxxxx"
  60. }
  61. }
  62. },
  63. "requestTransform": {
  64. "template": {
  65. "prompt": "{{prompt}}",
  66. "image_urls": "{{image_urls}}",
  67. "sizeDate": "{{sizeDate}}",
  68. "scale": "{{scale}}",
  69. "force_single": "{{force_single}}",
  70. "token": "{{token}}"
  71. }
  72. },
  73. "response": {
  74. "type": "object",
  75. "properties": {
  76. "code": {
  77. "type": "integer",
  78. "description": "响应状态码,200表示成功"
  79. },
  80. "data": {
  81. "type": "object",
  82. "properties": {
  83. "workId": {
  84. "type": "string",
  85. "description": "任务ID,用于后续查询任务状态和获取生成结果"
  86. }
  87. }
  88. }
  89. }
  90. },
  91. "notes": "提交任务后需调用 jimeng-task-query (getDataByTask02) 轮询任务状态。生成结果存储在 ImagineWork 表的 images 字段中,URL已转存永久有效。费用: 0.22元/张。",
  92. "usageExamples": [
  93. {
  94. "name": "纯文生图-2K分辨率",
  95. "input": {
  96. "prompt": "帮我生成一个涵盖友情、独特、文化底蕴、科技的可爱日漫风但人物为中国人的图片",
  97. "sizeDate": {
  98. "width": 2048,
  99. "height": 2048
  100. },
  101. "scale": 0.6,
  102. "force_single": false,
  103. "token": "Bearer r:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  104. },
  105. "description": "使用文本提示词生成2K分辨率的日漫风格图片"
  106. },
  107. {
  108. "name": "多图组合编辑",
  109. "input": {
  110. "prompt": "将模特穿上这件衣服",
  111. "image_urls": [
  112. "https://example.com/model.jpg",
  113. "https://example.com/clothes.png"
  114. ],
  115. "sizeDate": {
  116. "width": 2048,
  117. "height": 2048
  118. },
  119. "token": "Bearer r:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  120. },
  121. "description": "输入模特图+衣服图,通过提示词描述编辑意图"
  122. }
  123. ],
  124. "relatedSkills": [
  125. "jimeng-task-query",
  126. "jimeng-text2img-v3",
  127. "jimeng-img2img-v3"
  128. ],
  129. "pricing": {
  130. "unit": "张",
  131. "price": 0.22,
  132. "currency": "CNY",
  133. "reference": "https://www.volcengine.com/docs/85621/1544714"
  134. },
  135. "timeout": 30000,
  136. "retry": {
  137. "maxAttempts": 2,
  138. "delay": 1000,
  139. "backoffMultiplier": 2
  140. },
  141. "tokenConfig": {
  142. "type": "bearer",
  143. "configFile": "~/.openclaw/voc-credentials.json",
  144. "tokenField": "vocToken",
  145. "resolutionOrder": [
  146. "configFile"
  147. ],
  148. "apigId": "Vo3ROWEvDy",
  149. "paymentUrlResolution": {
  150. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  151. "steps": [
  152. "1. 从 voc-credentials.json 获取当前 session token",
  153. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  154. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  155. "4. 将该URL展示给用户,引导扫码支付"
  156. ],
  157. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  158. "userResolveHeaders": {
  159. "X-Parse-Application-Id": "ncloudmaster",
  160. "X-Parse-Session-Token": "{vocToken}"
  161. },
  162. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  163. "paymentParams": {
  164. "user": "{resolvedUserId}",
  165. "apigid": "Vo3ROWEvDy",
  166. "fun_id": "HOkkX72PMF"
  167. },
  168. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  169. },
  170. "onMissing": {
  171. "action": "showPaymentQR",
  172. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  173. "title": "扫码开通 VOC-AI 数据服务",
  174. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  175. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  176. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  177. },
  178. "onBalanceInsufficient": {
  179. "action": "resolveUserThenShowPayment",
  180. "title": "VOC-AI Token 余额不足,请扫码充值",
  181. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  182. }
  183. },
  184. "errorHandling": {
  185. "balanceInsufficient": {
  186. "conditions": [
  187. {
  188. "responseField": "code",
  189. "operator": "in",
  190. "value": [
  191. -2,
  192. -3,
  193. -10,
  194. 402,
  195. 429
  196. ]
  197. },
  198. {
  199. "responseField": "msg",
  200. "operator": "contains",
  201. "value": [
  202. "余额不足",
  203. "insufficient",
  204. "balance",
  205. "quota",
  206. "没有开通",
  207. "权限或余额"
  208. ]
  209. },
  210. {
  211. "responseField": "mess",
  212. "operator": "contains",
  213. "value": [
  214. "余额不足",
  215. "insufficient",
  216. "balance",
  217. "quota",
  218. "没有开通",
  219. "权限或余额"
  220. ]
  221. },
  222. {
  223. "responseField": "message",
  224. "operator": "contains",
  225. "value": [
  226. "余额不足",
  227. "insufficient",
  228. "balance",
  229. "没有开通",
  230. "权限或余额"
  231. ]
  232. }
  233. ],
  234. "matchMode": "any",
  235. "trigger": "tokenConfig.onBalanceInsufficient"
  236. },
  237. "unauthorized": {
  238. "conditions": [
  239. {
  240. "responseField": "code",
  241. "operator": "in",
  242. "value": [
  243. 401,
  244. 403
  245. ]
  246. },
  247. {
  248. "responseField": "msg",
  249. "operator": "contains",
  250. "value": [
  251. "unauthorized",
  252. "token",
  253. "invalid",
  254. "auth"
  255. ]
  256. }
  257. ],
  258. "matchMode": "any",
  259. "trigger": "tokenConfig.onMissing"
  260. }
  261. }
  262. }