Skip to content

Midjourney 提交 Shorten 任务 API 文档

接口地址

https://www.dmxaip.cn/mj/submit/shorten

参数说明

参数名称参数含义是否必选参数类型备注与示例
prompt提示词string这是生成图像的核心指令,描述了您希望生成的内容。例如:(Cat)
mode调用模式string默认为 RELAX(慢速模式)。可选项为 RELAXFAST(快速模式)。
notifyhook回调地址string用于接收任务执行结果的通知地址。为空时,则不进行回调通知。
botTypeBot 类型string指定使用的AI模型类型。mj 代表 MID_JOURNEY,niji 代表 NIJI_JOURNEY(更适合动漫风格)。
state自定义参数string一个自由定义的字符串,通常用于在回调通知中带回自定义上下文,便于您区分和处理不同请求。

示例代码

python
import requests
import json

url = "https://www.dmxapi.cn/mj/submit/shorten"
API_KEY = "sk-********************************"  #更换成你的 DMXAPI 令牌

payload = json.dumps({
   "botType": "MID_JOURNEY",
   "prompt": "Cat",
   "accountFilter": {
      "instanceId": "string",
      "modes": [
         "RELAX"
      ],
      "remix": True,
      "remixAutoConsidered": True
   },
   "notifyHook": "string",
   "state": "string"
})

headers = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

返回结果

json
{
    "code": 1,
    "description": "提交成功",
    "properties": {},
    "result": 1320098173412546
}

一个 Key 用全球大模型