Skip to content

Midjourney Proxy

Midjourney Proxy 接口用于提交 MJ 生图任务,并通过任务查询接口轮询结果。当前支持文生图、变体、高清和重绘。

MJ 查询接口会返回生成结果。图片结果在 images[].image_url 中读取。

接口地址

能力方法路径
文生图POST/mj/submit/imagine
变体 / 高清 / 重绘POST/mj/submit/change
简写操作POST/mj/submit/simple-change
查询任务GET/mj/task/{id}/fetch

文生图

http
POST /mj/submit/imagine

参数

参数必填说明
prompt图片提示词

示例

bash
curl -X POST https://cubicspaces.cloud/mj/submit/imagine \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "prompt": "A simple red ceramic mug on a clean white studio background"
  }'

返回

json
{
  "code": 1,
  "description": "提交成功",
  "result": "mj-task-id"
}

保存 result,后续用任务查询接口轮询状态。

查询任务

http
GET /mj/task/{id}/fetch
bash
curl https://cubicspaces.cloud/mj/task/mj-task-id/fetch \
  -H "Authorization: Bearer YOUR_API_KEY"

返回示例

json
{
  "extra": {
    "has_nsfw_contents": []
  },
  "task": {
    "task_id": "mj-task-id",
    "task_type": "MIDJOURNEY_TEXT_TO_IMAGE_FAST_MODE",
    "status": "TASK_STATUS_SUCCEED",
    "reason": "",
    "eta": 0,
    "progress_percent": 0
  },
  "images": [
    {
      "image_url": "https://example.com/generated-1.png",
      "image_url_ttl": "0",
      "image_type": "png",
      "nsfw_detection_result": null
    },
    {
      "image_url": "https://example.com/generated-2.png",
      "image_url_ttl": "0",
      "image_type": "png",
      "nsfw_detection_result": null
    }
  ],
  "videos": [],
  "audios": []
}

任务状态

状态说明
TASK_STATUS_QUEUED任务排队中
TASK_STATUS_PROCESSING任务处理中
TASK_STATUS_SUCCEED已完成,读取 images[].image_url
TASK_STATUS_FAILED失败,查看 task.reason

建议每 5 秒轮询一次,直到任务进入成功或失败状态。

变体

变体会基于原任务里的某一张图继续生成相似但不同的新图。

http
POST /mj/submit/change
参数必填说明
taskId原始任务 ID
action固定为 VARIATION
index原图序号,取值 14
bash
curl -X POST https://cubicspaces.cloud/mj/submit/change \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "taskId": "mj-task-id",
    "action": "VARIATION",
    "index": 1
  }'

高清

高清会把原任务里的某一张图单独高清化。

http
POST /mj/submit/change
参数必填说明
taskId原始任务 ID
action固定为 UPSCALE
index原图序号,取值 14
bash
curl -X POST https://cubicspaces.cloud/mj/submit/change \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "taskId": "mj-task-id",
    "action": "UPSCALE",
    "index": 1
  }'

重绘

重绘会基于原任务重新生成一批图片。

http
POST /mj/submit/change
参数必填说明
taskId原始任务 ID
action固定为 REROLL
bash
curl -X POST https://cubicspaces.cloud/mj/submit/change \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "taskId": "mj-task-id",
    "action": "REROLL"
  }'

简写操作

也可以使用 /mj/submit/simple-change 传入简写指令:

bash
curl -X POST https://cubicspaces.cloud/mj/submit/simple-change \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "content": "mj-task-id U1"
  }'

常见简写:

写法等价操作
mj-task-id U1高清第 1 张
mj-task-id V1变体第 1 张
mj-task-id R重绘

注意事项

  • index 使用 MJ 风格的 14
  • 操作接口返回的新任务 ID 也需要通过 /mj/task/{id}/fetch 轮询。
  • 变体、高清和重绘必须基于同一账号可访问的原任务。
  • 当前支持 mj_imaginemj_variationmj_upscalemj_reroll