UniAPI API Doc
首页全部OpenAI平台接口音乐模型图像模型视频模型
首页全部OpenAI平台接口音乐模型图像模型视频模型
  1. MidJourney
  • MidJourney
    • API接入说明类型
    • 任务提交
      • 提交Imagine任务(文生图、文图生图)
      • 提交Blend任务(图生图)
      • 提交Describe任务(图生文)
      • 提交Shorten任务(prompt分析)
      • 执行动作(所有的关联按钮动作UPSCALE; VARIATION; REROLL; ZOOM等)
      • 提交Modal(提交局部重绘、ZOOM)
      • 上传图片获得url
      • 绘图变化(UPSCALE; VARIATION; REROLL)
      • 绘图变化-simple(UPSCALE; VARIATION; REROLL)
    • 换脸
      • 提交swap_face任务
    • 查询任务
      • 根据ID列表查询任务
      • 指定ID获取任务
      • 获取任务图片的seed
  • ideogram
    • Generates(文生图)
      POST
    • Remix(混合图)
      POST
    • Upscale(放大高清)
      POST
    • Describe(描述)
      POST
  • FalAI
    • Openai 格式
      POST
    • 提交任务
      POST
    • 获取任务状态
      GET
    • 获取任务结果
      GET
  • 即梦
    • Openai 格式
      POST
  • Kling
    • 图像生成(文生图/图生图)
      POST
    • 图像生成 获取状态
      GET
    • 虚拟试穿
      POST
    • 虚拟试穿 获取状态
      GET
  1. MidJourney

API接入说明类型

地址说明#

默认地址: https://{BASE_URL}/mj/submit/imagine

模式说明#

Relax模式请求路径:/mj-relax
Fast模式请求路径:/mj-fast
Turbo模式请求路径:/mj-turbo
不同模式只需要在默认地址中的mj前面增加路径,例如:
Relax模式: https://{BASE_URL}/mj-relax/mj/submit/imagine

API接口类型#

介绍各种接口的类型。

新任务创建#

提交Imagine任务(文生图、文图生图): /mj/submit/imagine
提交Blend任务(图生图): /mj/submit/blend
提交Describe任务(图生文): /mj/submit/describe
提交Shorten任务(prompt分析): /mj/submit/shorten

任务再操作#

执行动作(所有的关联按钮动作UPSCALE; VARIATION; REROLL; ZOOM等): /mj/submit/action
提交Modal(提交局部重绘、ZOOM): /mj/submit/modal

任务查询#

指定ID获取任务: /mj/task/{id}/fetch

大致流程#

1.
使用Imagine接口进行绘图,会响应一个任务id
2.
使用查询任务接口查询任务ID获得绘图结果,结果里可以得到图片链接和可以操作的按钮。每个操作对应单独的custiom_id。
3.
如果想对图片操作,调用Action接口;使用刚才查询任务时获得的custom_id和任务id,进行操作,会得到新的任务ID,重复第二步继续对新任务查询任务结果。(如果调用Action接口,提示弹窗,需要使用这个任务ID再次调用Modal接口。)

API示例#

curl 示例#

第一步:提交Imagine任务#

请求:
响应:
{
    "code": 1,
    "description": "提交成功",
    "properties": {},
    "result": 1320098173412546
}
result是任务ID

第二步: 根据任务ID获取任务结果#

由第一步得到任务ID为 1320098173412546,得到返回结果。
请求:
响应:
{
    "id": "1320098173412546",
    "action": "IMAGINE",
    "prompt": "cat --v 6.1",
    "promptEn": "cat --v 6.1",
    "description": "Submit success",
    "state": "",
    "submitTime": 1741531578038,
    "startTime": 1741531580190,
    "finishTime": 1741531608566,
    "imageUrl": "https://img.innk.cc/attachments/1320066655572987907/1348306030429470862/adam_rivera4952_cat_26d56b92-4ed6-45e2-8561-563797923135.png?ex=67cefb57\u0026is=67cda9d7\u0026hm=b87e6b24e4bc3c2f1584b72154075607d6115602d0e5c7777e6637c29b8d3bd5\u0026",
    "status": "SUCCESS",
    "progress": "100%",
    "failReason": "",
    "properties": {
        "botType": "MID_JOURNEY",
        "discordChannelId": 8774786694361674000,
        "discordInstanceId": 7415633538733103000,
        "finalPrompt": "cat --v 6.1 --sref \u003chttps://s.mj.run/ktqQpnwPoPk\u003e",
        "flags": 0,
        "messageContent": "**cat --v 6.1 --sref \u003chttps://s.mj.run/ktqQpnwPoPk\u003e** - \u003c@1343445981269594182\u003e (relaxed)",
        "messageHash": "26d56b92-4ed6-45e2-8561-563797923135",
        "messageId": "1348306030706036789",
        "nonce": "1619855216344100864",
        "notifyHook": "",
        "progressMessageId": "1348305922325479495"
    },
    "buttons": [
        {
            "customId": "MJ::JOB::upsample::1::26d56b92-4ed6-45e2-8561-563797923135",
            "emoji": "",
            "label": "U1",
            "style": 2,
            "type": 2
        },
        {
            "customId": "MJ::JOB::upsample::2::26d56b92-4ed6-45e2-8561-563797923135",
            "emoji": "",
            "label": "U2",
            "style": 2,
            "type": 2
        },
        {
            "customId": "MJ::JOB::upsample::3::26d56b92-4ed6-45e2-8561-563797923135",
            "emoji": "",
            "label": "U3",
            "style": 2,
            "type": 2
        },
        {
            "customId": "MJ::JOB::upsample::4::26d56b92-4ed6-45e2-8561-563797923135",
            "emoji": "",
            "label": "U4",
            "style": 2,
            "type": 2
        },
        {
            "customId": "MJ::JOB::reroll::0::26d56b92-4ed6-45e2-8561-563797923135::SOLO",
            "emoji": "🔄",
            "label": "",
            "style": 2,
            "type": 2
        },
        {
            "customId": "MJ::JOB::variation::1::26d56b92-4ed6-45e2-8561-563797923135",
            "emoji": "",
            "label": "V1",
            "style": 2,
            "type": 2
        },
        {
            "customId": "MJ::JOB::variation::2::26d56b92-4ed6-45e2-8561-563797923135",
            "emoji": "",
            "label": "V2",
            "style": 2,
            "type": 2
        },
        {
            "customId": "MJ::JOB::variation::3::26d56b92-4ed6-45e2-8561-563797923135",
            "emoji": "",
            "label": "V3",
            "style": 2,
            "type": 2
        },
        {
            "customId": "MJ::JOB::variation::4::26d56b92-4ed6-45e2-8561-563797923135",
            "emoji": "",
            "label": "V4",
            "style": 2,
            "type": 2
        }
    ]
}
不断轮询查询任务接口,直到 status 为 SUCCESS.
如果你只是想要生成图片,那么到这里就结束了。

第三步: 点击按钮,执行动作#

查询接口返回的 buttons 属性为可点击按钮,将对应的按钮 customId,传入接口 /mj/submit/action中,可执行对应的操作。
请求:
响应:
{
    "code": 1,
    "description": "提交成功",
    "properties": {},
    "result": 1320098173412547
}

第四步: 重复获取任务接口#

由第三步得到任务ID为 1320098173412547,得到返回结果。这个和第二步是一样的操作,只是任务ID改变了。
请求:

Python 示例#

code含义#

code=1: 提交成功,result为任务ID
{
  "code": 1,
  "description": "提交成功",
  "result": "14001929738841620",
  "properties": {
      "discordInstanceId": "1118138338562560102"
  }
}
code=22: 提交成功,进入队列等待
{
    "code": 22,
    "description": "排队中,前面还有1个任务",
    "result": "14001929738841620",
    "properties": {
        "numberOfQueues": 1,
        "discordInstanceId": "1118138338562560102"
     }
}
code=23: 队列已满,请稍后尝试
{
    "code": 23,
    "description": "队列已满,请稍后尝试",
    "result": "14001929738841620",
    "properties": {
        "discordInstanceId": "1118138338562560102"
     }
}
code=24: prompt包含敏感词
{
    "code": 24,
    "description": "可能包含敏感词",
    "properties": {
        "promptEn": "nude body",
        "bannedWord": "nude"
     }
}
other: 提交错误,description为错误描述
修改于 2025-07-18 09:00:22
下一页
提交Imagine任务(文生图、文图生图)
Built with