Imagine(文生图)
curl --request POST \
--url https://openp.ai/mj/submit/imagineimport requests
url = "https://openp.ai/mj/submit/imagine"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://openp.ai/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://openp.ai/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",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://openp.ai/mj/submit/imagine"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openp.ai/mj/submit/imagine")
.asString();require 'uri'
require 'net/http'
url = URI("https://openp.ai/mj/submit/imagine")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body视频与图像生成
Imagine(文生图)
POST /mj/submit/imagine —— 提交 Midjourney 文生图任务
POST
/
mj
/
submit
/
imagine
Imagine(文生图)
curl --request POST \
--url https://openp.ai/mj/submit/imagineimport requests
url = "https://openp.ai/mj/submit/imagine"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://openp.ai/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://openp.ai/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",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://openp.ai/mj/submit/imagine"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openp.ai/mj/submit/imagine")
.asString();require 'uri'
require 'net/http'
url = URI("https://openp.ai/mj/submit/imagine")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body提交一个 Midjourney 文生图任务(等价于 Discord 的
/imagine)。
请求
curl https://openp.ai/mj/submit/imagine \
-H "Authorization: Bearer $OPENPAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic cyberpunk city at night, neon lights, --ar 16:9 --v 6",
"notifyHook": "https://your-server.com/mj-callback"
}'
参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
prompt | string | ✅ | 生成提示词,可包含 --ar、--v、--style 等参数 |
base64Array | array | 参考图 base64 数组(/imagine 附带垫图) | |
notifyHook | string | 回调 URL,任务完成时 OpenPAI 会 POST 任务结果 | |
state | string | 自定义透传字段,会原样回传到回调 | |
botType | string | MID_JOURNEY(默认)或 NIJI_JOURNEY |
响应
{
"code": 1,
"description": "Submitted",
"result": "1737200000000000",
"properties": {}
}
result 即任务 ID,后续用它查询进度或提交 U/V 操作。
| code | 含义 |
|---|---|
1 | 提交成功 |
21 | 已存在相同任务(将复用) |
22 | 任务进入队列等待 |
-1 | 提交失败,见 description |