跳转到主要内容

提交 Imagine 任务

POST /mj/submit/imagine
提交一个 Midjourney Imagine 任务,根据提示词生成图像。

请求参数

参数类型必填说明
botTypestring机器人类型:MID_JOURNEY(默认)或 NIJI_JOURNEY
promptstring提示词,支持 Midjourney 原生语法(如 --ar 16:9 --v 6
base64ArrayarrayBase64 编码的参考图片数组,用于垫图
notifyHookstring任务状态变更回调地址
statestring自定义状态信息,会在回调中原样返回

请求示例

curl -X POST https://crazyrouter.com/mj/submit/imagine \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "botType": "MID_JOURNEY",
    "prompt": "a beautiful sunset over the ocean, cinematic lighting --ar 16:9 --v 6",
    "notifyHook": "",
    "state": ""
  }'

响应示例

{
  "code": 1,
  "description": "提交成功",
  "result": "task_1234567890",
  "properties": {}
}
字段说明
code状态码,1 表示成功,22 表示排队中
description状态描述
result任务 ID,用于后续查询

带垫图的请求

使用 base64Array 传入参考图片:
cURL
curl -X POST https://crazyrouter.com/mj/submit/imagine \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "botType": "MID_JOURNEY",
    "prompt": "a cat in the style of the reference image --v 6",
    "base64Array": [
      "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg..."
    ]
  }'

使用 Niji Journey

botType 设为 NIJI_JOURNEY 使用 Niji 模型生成动漫风格图片:
{
  "botType": "NIJI_JOURNEY",
  "prompt": "a cute anime girl with blue hair, cherry blossoms --niji 6"
}
提交成功后返回任务 ID,需通过 查询任务状态 接口获取生成结果。
base64Array 中的图片会增加请求体积,建议单张图片不超过 4MB。