Midjourney 任务提交
curl --request POST \
--url https://www.geeknow.top/mj/submit/imagine \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mode": "<string>",
"prompt": "<string>",
"base64Array": [
"<string>"
],
"state": "<string>",
"notifyHook": "<string>",
"dimensions": "<string>",
"botType": "<string>",
"taskId": "<string>",
"maskBase64": "<string>",
"index": 123,
"motion": "<string>",
"action": "<string>"
}
'import requests
url = "https://www.geeknow.top/mj/submit/imagine"
payload = {
"mode": "<string>",
"prompt": "<string>",
"base64Array": ["<string>"],
"state": "<string>",
"notifyHook": "<string>",
"dimensions": "<string>",
"botType": "<string>",
"taskId": "<string>",
"maskBase64": "<string>",
"index": 123,
"motion": "<string>",
"action": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
mode: '<string>',
prompt: '<string>',
base64Array: ['<string>'],
state: '<string>',
notifyHook: '<string>',
dimensions: '<string>',
botType: '<string>',
taskId: '<string>',
maskBase64: '<string>',
index: 123,
motion: '<string>',
action: '<string>'
})
};
fetch('https://www.geeknow.top/mj/submit/imagine', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.geeknow.top/mj/submit/imagine",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'mode' => '<string>',
'prompt' => '<string>',
'base64Array' => [
'<string>'
],
'state' => '<string>',
'notifyHook' => '<string>',
'dimensions' => '<string>',
'botType' => '<string>',
'taskId' => '<string>',
'maskBase64' => '<string>',
'index' => 123,
'motion' => '<string>',
'action' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.geeknow.top/mj/submit/imagine"
payload := strings.NewReader("{\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"base64Array\": [\n \"<string>\"\n ],\n \"state\": \"<string>\",\n \"notifyHook\": \"<string>\",\n \"dimensions\": \"<string>\",\n \"botType\": \"<string>\",\n \"taskId\": \"<string>\",\n \"maskBase64\": \"<string>\",\n \"index\": 123,\n \"motion\": \"<string>\",\n \"action\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.geeknow.top/mj/submit/imagine")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"base64Array\": [\n \"<string>\"\n ],\n \"state\": \"<string>\",\n \"notifyHook\": \"<string>\",\n \"dimensions\": \"<string>\",\n \"botType\": \"<string>\",\n \"taskId\": \"<string>\",\n \"maskBase64\": \"<string>\",\n \"index\": 123,\n \"motion\": \"<string>\",\n \"action\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.geeknow.top/mj/submit/imagine")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"base64Array\": [\n \"<string>\"\n ],\n \"state\": \"<string>\",\n \"notifyHook\": \"<string>\",\n \"dimensions\": \"<string>\",\n \"botType\": \"<string>\",\n \"taskId\": \"<string>\",\n \"maskBase64\": \"<string>\",\n \"index\": 123,\n \"motion\": \"<string>\",\n \"action\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 1,
"description": "Submit success",
"result": "1712158011464906"
}
Midjourney
Midjourney 任务提交
提交 Midjourney 的 imagine、blend、modal、describe、shorten、swap face、video 和上传 Discord 图片任务。
POST
https://www.geeknow.top
/
mj
/
submit
/
imagine
Midjourney 任务提交
curl --request POST \
--url https://www.geeknow.top/mj/submit/imagine \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mode": "<string>",
"prompt": "<string>",
"base64Array": [
"<string>"
],
"state": "<string>",
"notifyHook": "<string>",
"dimensions": "<string>",
"botType": "<string>",
"taskId": "<string>",
"maskBase64": "<string>",
"index": 123,
"motion": "<string>",
"action": "<string>"
}
'import requests
url = "https://www.geeknow.top/mj/submit/imagine"
payload = {
"mode": "<string>",
"prompt": "<string>",
"base64Array": ["<string>"],
"state": "<string>",
"notifyHook": "<string>",
"dimensions": "<string>",
"botType": "<string>",
"taskId": "<string>",
"maskBase64": "<string>",
"index": 123,
"motion": "<string>",
"action": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
mode: '<string>',
prompt: '<string>',
base64Array: ['<string>'],
state: '<string>',
notifyHook: '<string>',
dimensions: '<string>',
botType: '<string>',
taskId: '<string>',
maskBase64: '<string>',
index: 123,
motion: '<string>',
action: '<string>'
})
};
fetch('https://www.geeknow.top/mj/submit/imagine', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.geeknow.top/mj/submit/imagine",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'mode' => '<string>',
'prompt' => '<string>',
'base64Array' => [
'<string>'
],
'state' => '<string>',
'notifyHook' => '<string>',
'dimensions' => '<string>',
'botType' => '<string>',
'taskId' => '<string>',
'maskBase64' => '<string>',
'index' => 123,
'motion' => '<string>',
'action' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.geeknow.top/mj/submit/imagine"
payload := strings.NewReader("{\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"base64Array\": [\n \"<string>\"\n ],\n \"state\": \"<string>\",\n \"notifyHook\": \"<string>\",\n \"dimensions\": \"<string>\",\n \"botType\": \"<string>\",\n \"taskId\": \"<string>\",\n \"maskBase64\": \"<string>\",\n \"index\": 123,\n \"motion\": \"<string>\",\n \"action\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.geeknow.top/mj/submit/imagine")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"base64Array\": [\n \"<string>\"\n ],\n \"state\": \"<string>\",\n \"notifyHook\": \"<string>\",\n \"dimensions\": \"<string>\",\n \"botType\": \"<string>\",\n \"taskId\": \"<string>\",\n \"maskBase64\": \"<string>\",\n \"index\": 123,\n \"motion\": \"<string>\",\n \"action\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.geeknow.top/mj/submit/imagine")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"base64Array\": [\n \"<string>\"\n ],\n \"state\": \"<string>\",\n \"notifyHook\": \"<string>\",\n \"dimensions\": \"<string>\",\n \"botType\": \"<string>\",\n \"taskId\": \"<string>\",\n \"maskBase64\": \"<string>\",\n \"index\": 123,\n \"motion\": \"<string>\",\n \"action\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 1,
"description": "Submit success",
"result": "1712158011464906"
}
Midjourney 任务提交
Midjourney 提交接口统一属于/mj/submit/* 这一组。不同动作使用不同路径,但成功响应风格基本一致。
通用响应
{
"code": 1,
"description": "Submit success",
"result": "1712158011464906"
}
状态码。常见值:
1 提交成功、22 排队中、23 队列已满、24 prompt 可能包含敏感词。状态说明。
任务 ID。上传 Discord 图片接口返回的是图片 URL 数组。
认证
Authorization: Bearer YOUR_API_KEY
提交 Imagine 任务
POST /mj/submit/imagine
Imagine 操作,提交绘图任务。
{
"mode": "RELAX",
"prompt": "Cat",
"base64Array": [
"data:image/png;base64,xxx1",
"data:image/png;base64,xxx2"
],
"state": "",
"notifyHook": ""
}
调用模式,常见值为
RELAX、FAST。提示词。
垫图 Base64 数组。
自定义参数。
回调地址。
提交 Blend 任务
POST /mj/submit/blend
Blend 操作,提交融图任务。
{
"mode": "RELAX",
"base64Array": [
"data:image/png;base64,xxx1",
"data:image/png;base64,xxx2"
],
"dimensions": "SQUARE",
"botType": "mj",
"notifyHook": "",
"state": ""
}
调用模式,常见值为
RELAX、FAST。图片 Base64 数组。
比例。常见值:
PORTRAIT、SQUARE、LANDSCAPE。bot 类型,常见值:
mj、niji。回调地址。
自定义参数。
提交 Modal 任务
POST /mj/submit/modal
code = 21 或需要补充提示词时,可调用该接口继续提交。
{
"taskId": "1712204995849323",
"maskBase64": "data:image/png;base64,xxx1",
"prompt": "Cat"
}
原任务 ID。
局部重绘蒙版 Base64。
新的提示词。
提交 Describe 任务
POST /mj/submit/describe
Describe 操作,提交图生文任务。
{
"mode": "RELAX",
"base64": "data:image/png;base64,xxx",
"botType": "mj",
"notifyHook": "",
"state": ""
}
接口使用
base64Array 接收图片数组。如果只上传一张图,也建议放入数组中提交。提交 Shorten 任务
POST /mj/submit/shorten
Shorten 操作。
{
"mode": "RELAX",
"prompt": "Cat",
"botType": "mj",
"notifyHook": "",
"state": ""
}
提交 SwapFace 任务
POST /mj/insight-face/swap
SwapFace 换脸任务。
SwapFace 接口使用 JSON Base64 请求体:
{
"sourceBase64": "data:image/png;base64,xxx1",
"targetBase64": "data:image/png;base64,xxx2"
}
该接口当前需要传入
sourceBase64 与 targetBase64。如果缺少任一字段,会返回 sour_base64_and_target_base64_is_required。提交 Video 任务
POST /mj/submit/video
- 基于
prompt直接生成视频 - 基于已有
taskId继续生成视频
{
"mode": "FAST",
"prompt": "a car",
"taskId": "1712204995849323",
"index": 1,
"motion": "low",
"image": "url",
"action": "extend",
"state": "",
"notifyHook": ""
}
调用模式,常见值为
RELAX、FAST。父任务 ID。基于已有图片扩展视频时使用。
视频索引号。
运动强度,常见值:
low、high。视频任务动作。示例里常见值为
extend。上传文件到 Discord
POST /mj/submit/upload-discord-images
{
"mode": "RELAX",
"base64Array": [
"data:image/png;base64,xxx1"
]
}
{
"code": 1,
"description": "success",
"result": [
"https://cdn.discordapp.com/attachments/..."
]
}
常见本地校验错误
| 描述 | 常见触发条件 |
|---|---|
bind_request_body_failed | 请求体格式错误 |
prompt_is_required | Imagine 未传 prompt |
task_id_is_required | 需要基于任务继续操作时未传 taskId |
action_is_required | 继续操作类接口缺少 action |
index_is_required | 继续操作类接口缺少 index |
content_is_required | simple-change 类操作缺少 content |
task_not_found | 传入的原任务不存在 |
task_status_not_success | 需要依赖原任务成功态时,原任务尚未成功 |
quota_not_enough | 余额不足 |
相关接口
⌘I