api-config.json 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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. "currentToken": "r:858b3ee92314d5447d1fc3cdc10462d7",
  146. "resolutionOrder": [
  147. "configFile",
  148. "currentToken"
  149. ],
  150. "apigId": "Vo3ROWEvDy",
  151. "paymentUrlResolution": {
  152. "description": "动态构建充值URL:通过当前token查出用户objectId,拼接到充值页面",
  153. "steps": [
  154. "1. 从 voc-credentials.json 或 currentToken 获取当前 session token",
  155. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  156. "3. 拼接充值URL: https://pwa.fmode.cn/apig-pay.html?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  157. "4. 将该URL展示给用户,引导扫码支付"
  158. ],
  159. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  160. "userResolveHeaders": {
  161. "X-Parse-Application-Id": "ncloudmaster",
  162. "X-Parse-Session-Token": "{vocToken}"
  163. },
  164. "paymentBaseUrl": "https://pwa.fmode.cn/apig-pay.html",
  165. "paymentParams": {
  166. "user": "{resolvedUserId}",
  167. "apigid": "Vo3ROWEvDy",
  168. "fun_id": "HOkkX72PMF"
  169. },
  170. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  171. },
  172. "onMissing": {
  173. "action": "resolveUserThenShowPayment",
  174. "title": "扫码开通 VOC-AI 数据服务",
  175. "message": "此 Skill 需要有效的 API Token。请按以下步骤操作:\n1. 如果你已有 Token,请告诉我,我会保存到 ~/.openclaw/voc-credentials.json\n2. 如果没有 Token,我会引导你扫码充值开通"
  176. },
  177. "onBalanceInsufficient": {
  178. "action": "resolveUserThenShowPayment",
  179. "title": "VOC-AI Token 余额不足,请扫码充值",
  180. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  181. }
  182. },
  183. "errorHandling": {
  184. "balanceInsufficient": {
  185. "conditions": [
  186. {
  187. "responseField": "code",
  188. "operator": "in",
  189. "value": [
  190. -2,
  191. -3,
  192. -10,
  193. 402,
  194. 429
  195. ]
  196. },
  197. {
  198. "responseField": "msg",
  199. "operator": "contains",
  200. "value": [
  201. "余额不足",
  202. "insufficient",
  203. "balance",
  204. "quota"
  205. ]
  206. },
  207. {
  208. "responseField": "message",
  209. "operator": "contains",
  210. "value": [
  211. "余额不足",
  212. "insufficient",
  213. "balance"
  214. ]
  215. }
  216. ],
  217. "matchMode": "any",
  218. "trigger": "tokenConfig.onBalanceInsufficient"
  219. },
  220. "unauthorized": {
  221. "conditions": [
  222. {
  223. "responseField": "code",
  224. "operator": "in",
  225. "value": [
  226. 401,
  227. 403
  228. ]
  229. },
  230. {
  231. "responseField": "msg",
  232. "operator": "contains",
  233. "value": [
  234. "unauthorized",
  235. "token",
  236. "invalid",
  237. "auth"
  238. ]
  239. }
  240. ],
  241. "matchMode": "any",
  242. "trigger": "tokenConfig.onMissing"
  243. }
  244. }
  245. }