Midjourney 提交 Shorten 任务 API 文档
接口地址
https://www.dmxaip.cn/mj/submit/shorten
参数说明
参数名称 | 参数含义 | 是否必选 | 参数类型 | 备注与示例 |
---|---|---|---|---|
prompt | 提示词 | 是 | string | 这是生成图像的核心指令,描述了您希望生成的内容。例如:(Cat) |
mode | 调用模式 | 否 | string | 默认为 RELAX (慢速模式)。可选项为 RELAX 或 FAST (快速模式)。 |
notifyhook | 回调地址 | 否 | string | 用于接收任务执行结果的通知地址。为空时,则不进行回调通知。 |
botType | Bot 类型 | 否 | 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
}