生成图像
- 文生图、混图、反推各走独立路径
- 原生 MJ 参数写在 prompt 里
- 提交后仍需 fetch 取结果
认证
所有接口均使用 Bearer Token 进行认证。获取 API Key:访问控制台 创建。请求时在请求头中添加:
All endpoints authenticate with a Bearer token. Create a key in the console and add it to the request header:
三种生成方式
| 方式 | 端点 | 说明 |
|---|---|---|
| 文生图 | POST /mj/submit/imagine | 只给提示词,出一个四宫格 |
| 图片融合 | POST /mj/submit/blend | 2 到 5 张图融合,不接受 prompt |
| 反推提示词 | POST /mj/submit/describe | 传 1 张图,返回提示词候选 |
原生 MJ 参数直接写在 prompt 里,例如 a cute cat --ar 16:9 --v 7。请求体里没有单独的 size、version 字段。
| Mode | Endpoint | Notes |
|---|---|---|
| Text to image | POST /mj/submit/imagine | Prompt only; returns a four-image grid |
| Blend | POST /mj/submit/blend | Blends 2 to 5 images; no prompt |
| Describe | POST /mj/submit/describe | One image in, prompt candidates out |
Native MJ parameters go inline in prompt, e.g. a cute cat --ar 16:9 --v 7. There is no separate size or version field.
请求参数
提示词,/imagine 必填。原生 MJ 参数可内联。
bot 类型,MID_JOURNEY(默认)或 NIJI_JOURNEY。
垫图,data:image/png;base64,... 形式。/blend 必填,2 到 5 张。
仅 /blend 使用,PORTRAIT(2:3)、SQUARE(1:1)、LANDSCAPE(3:2)。
仅 /describe 使用,图片 Base64,与 link 二选一。
仅 /describe 使用,图片链接,与 base64 二选一。
仅 /describe 使用,en(默认)或 zh_cn。
回调地址,任务完成时平台向该地址 POST 结果。
为 true 时返回官方链接,默认 false。
自定义透传字段,原样带回。
账号筛选,modes 可指定 ["RELAX"] 这类速度模式。
Required for /imagine. Native MJ parameters can be inlined.
MID_JOURNEY (default) or NIJI_JOURNEY.
Reference images as data:image/png;base64,.... Required for /blend, 2 to 5 images.
/blend only: PORTRAIT (2:3), SQUARE (1:1), LANDSCAPE (3:2).
/describe only: image Base64, exclusive with link.
/describe only: image URL, exclusive with base64.
/describe only: en (default) or zh_cn.
Callback URL; the platform POSTs the result there on completion.
Return official links instead of mirrored ones; default false.
Opaque value echoed back unchanged.
Account filtering; modes can request a speed mode such as ["RELAX"].
常用 MJ 参数
直接写在 prompt 末尾:
| 参数 | 含义 | 取值 |
|---|---|---|
--ar | 画幅比例 | 如 16:9、3:4 |
--v | 模型版本 | 如 7、6.1 |
--niji | 动漫风格 | 无值或版本号 |
--s | 艺术化强度 | 0 到 1000 |
--c | 变化程度 | 0 到 100 |
--no | 反向描述 | 如 --no text |
--tile | 平铺模式 | 无值 |
--q | 画质 | 0.25、0.5、1、2 |
--seed | 随机种子 | 整数 |
Append them to the end of prompt:
| Parameter | Meaning | Values |
|---|---|---|
--ar | Aspect ratio | e.g. 16:9, 3:4 |
--v | Model version | e.g. 7, 6.1 |
--niji | Anime style | No value or a version |
--s | Stylize | 0 to 1000 |
--c | Chaos | 0 to 100 |
--no | Negative | e.g. --no text |
--tile | Tile mode | No value |
--q | Quality | 0.25, 0.5, 1, 2 |
--seed | Seed | Integer |
错误码
| HTTP | 含义 |
|---|---|
| 200 | 已受理,看 code 判断是否成功 |
| 401 | Token 缺失或无效 |
| 429 | 触发限流 |
常见失败:prompt 缺失;/blend 传的图少于 2 张或多于 5 张;/describe 同时传了 base64 与 link。
| HTTP | Meaning |
|---|---|
| 200 | Accepted; check code for success |
| 401 | Token missing or invalid |
| 429 | Rate limit hit |
Common failures: missing prompt; fewer than 2 or more than 5 images on /blend; both base64 and link on /describe.
使用示例
文生图
提交后拿任务 ID,再 fetch 取四宫格。画幅、版本这些参数都写在提示词里。
图片融合
base64Array 传 2 到 5 张图,dimensions 决定画幅。
反推提示词
把一张参考图丢进去,得到提示词候选,挑一条再送去 /imagine。
Text to image
Submit, take the task ID, then fetch the grid. Ratio and version go inside the prompt.
Blend
Pass 2 to 5 images in base64Array; dimensions sets the aspect.
Describe
Send one reference image, get prompt candidates, then feed one into /imagine.