Midjourney非官方websocket api接口
支持bot:
支持功能:
注意事项:
access key
和secret key
请登录后台生成session_id
重连,否则可能丢失消息。开发接口,基于慢速模式作图,返回较慢,仅用于对接测试!
真实接口,消耗Fast额度,正式环境请使用此接口!
客户端发送给server端的消息列表
Accepts one of the following messages:
客户端在建立连接后,应该首先发送鉴权消息
{
"type": 7,
"data": {
"access_key": "i8d-OM2z69mKyxAlDN29vYrlB179P9xyk4kogIMeD7jiZYqTWCRwSw",
"timestamp": 1683617679,
"nonce": 2853052490354355,
"signature": "jzwNXiYTMEtjzTtHvqtEOSiQpBshZtcUK1SKJAru3TQ",
"session_id": 11232312
},
"state": "string"
}
客户端应该每隔5s发送心跳消息给server,超时server会断开连接
{
"type": 1,
"data": {
"access_key": "i8d-OM2z69mKyxAlDN29vYrlB179P9xyk4kogIMeD7jiZYqTWCRwSw"
},
"state": "string"
}
客户端发送给server的interaction消息,用于发起作图任务
{
"type": 4,
"data": {
"image_proxy": false,
"mode": "Relaxed",
"type": 1,
"imagine": {
"niji": false,
"prompt": "cat --v 5.1"
},
"upscale": {
"niji": false,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65",
"index": 1
},
"vary": {
"niji": true,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65",
"index": 1
},
"reroll": {
"niji": true,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65"
},
"describe": {
"niji": true,
"file_url": "https://pub-cc4c1f10781c4f63a50a0037a2aaf667.r2.dev/af0059c7713b2486a038c0fcceb397d3.jpg"
}
},
"state": "string"
}
服务器返回给客户端的消息列表
Accepts one of the following messages:
服务端返回的错误消息,仅用于表示本服务的错误,不代表midjourney返回的错误
{
"type": 3,
"data": {
"error": "无效的消息类型 0"
},
"state": "string"
}
服务器端返回的账号订阅信息
{
"type": 2,
"data": {
"session_id": 11232312,
"account_id": 11232312,
"expired_at": {},
"sub_mode": 0,
"count": 100
},
"state": "string"
}
客户端向server提交interaction后,服务端会返回一个task回执便于客户端追踪任务进度
{
"type": 5,
"data": {
"id": 1111222333,
"access_key": "i8d-OM2z69mKyxAlDN29vYrlB179P9xyk4kogIMeD7jiZYqTWCRwSw",
"session_id": 11232312,
"image_proxy": false,
"mode": "Relaxed",
"interaction": {
"image_proxy": false,
"mode": "Relaxed",
"type": 1,
"imagine": {
"niji": false,
"prompt": "cat --v 5.1"
},
"upscale": {
"niji": false,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65",
"index": 1
},
"vary": {
"niji": true,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65",
"index": 1
},
"reroll": {
"niji": true,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65"
},
"describe": {
"niji": true,
"file_url": "https://pub-cc4c1f10781c4f63a50a0037a2aaf667.r2.dev/af0059c7713b2486a038c0fcceb397d3.jpg"
}
}
},
"state": "string"
}
作图任务的进度响应
{
"type": 6,
"data": {
"task": {
"id": 1111222333,
"access_key": "i8d-OM2z69mKyxAlDN29vYrlB179P9xyk4kogIMeD7jiZYqTWCRwSw",
"session_id": 11232312,
"image_proxy": false,
"mode": "Relaxed",
"interaction": {
"image_proxy": false,
"mode": "Relaxed",
"type": 1,
"imagine": {
"niji": false,
"prompt": "cat --v 5.1"
},
"upscale": {
"niji": false,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65",
"index": 1
},
"vary": {
"niji": true,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65",
"index": 1
},
"reroll": {
"niji": true,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65"
},
"describe": {
"niji": true,
"file_url": "https://pub-cc4c1f10781c4f63a50a0037a2aaf667.r2.dev/af0059c7713b2486a038c0fcceb397d3.jpg"
}
}
},
"status": 1,
"error": {
"title": "Invalid link!",
"description": "Please check that your URL is a direct link to an image, not a webpage."
},
"describe": {
"raw_text": "1️⃣ anime wedding portrait, in portrait of a beautiful bride with pink hair and flowers, in the style of hand-coloring, whimsical animation, [fernando amorsolo](https://goo.gl/search?artist%20fernando%20amorsolo), shiny eyes, neogeo, stains/washes, 1st version \\n\\n2️⃣ an anime girl in a wedding dress with pink hair and white flowers, in the style of appropriation artist, hand-drawn animation, 1st version, shiny eyes, massurrealism, burne-jones, bold, manga-inspired characters \\n\\n3️⃣ an image of a girl in wedding dress and pink hair, in the style of manga-influenced, pictorial, traditional animation, appropriation artist, shiny eyes, commission for, flowerpunk \\n\\n4️⃣ a woman with bright pink hair in a wedding gown, in the style of quirky manga art, animated gifs, commission for, symmetrical, ivory, shiny eyes, appropriation artist"
},
"progress": {
"prompt": "cat --v 5.1",
"extra": "fast, stealth",
"progress_num": 0,
"progress_text": "78",
"message_id": "string",
"images": [
{
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65",
"url": "https://cdn.discordapp.com/attachments/1087954944591667212/1105088950642688032/importcjj_cat_54048daa-76d0-41a6-9bbe-4ba99d9eef65.png",
"proxy_url": "https://media.discordapp.net/attachments/1087954944591667212/1105088950642688032/importcjj_cat_54048daa-76d0-41a6-9bbe-4ba99d9eef65.png",
"type": "image/png",
"width": 2048,
"height": 2048,
"size": 7306880
}
]
},
"interactions": [
{
"image_proxy": false,
"mode": "Relaxed",
"type": 1,
"imagine": {
"niji": false,
"prompt": "cat --v 5.1"
},
"upscale": {
"niji": false,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65",
"index": 1
},
"vary": {
"niji": true,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65",
"index": 1
},
"reroll": {
"niji": true,
"prompt": "cat --v 5.1",
"guild_id": 1105088951347322900,
"channel_id": 1105088951347322900,
"message_id": 1105088951347322900,
"uuid": "54048daa-76d0-41a6-9bbe-4ba99d9eef65"
},
"describe": {
"niji": true,
"file_url": "https://pub-cc4c1f10781c4f63a50a0037a2aaf667.r2.dev/af0059c7713b2486a038c0fcceb397d3.jpg"
}
}
]
},
"state": "string"
}
客户端在建立连接后,应该首先发送鉴权消息
客户端应该每隔5s发送心跳消息给server,超时server会断开连接
客户端发送给server的interaction消息,用于发起作图任务
服务端返回的错误消息,仅用于表示本服务的错误,不代表midjourney返回的错误
服务器端返回的账号订阅信息
客户端向server提交interaction后,服务端会返回一个task回执便于客户端追踪任务进度
作图任务的进度响应
客户端鉴权消息类型
心跳消息类型
账号额度消息类型
错误消息类型
交互任务消息类型
任务回执消息类型
任务响应消息类型
交互任务的类型
交互任务的状态
账号订阅信息:
两种执行模式,慢速和快速
客户端鉴权数据
服务器返回的错误,非midjourney的错误
任务回执
任务进度响应
账号的订阅信息
客户端的心跳数据
客户端发送给server的interaction,比如imagine
通过提示词生成图片
获取指定的图片
对指定的图片进行微调
重新生成图片
给定图片地址, 获取图片的4段描述文本.
图片的描述结果
交互命令imagine
, vary
, reroll
的通用返回,完成的交互任务process_num
等于100
midjourney生成的图片对象
midjourney返回的错误信息