Midjourney
Midjourney modal 작업 생성
POST /mj/submit/modal을 사용해 zoom 또는 area redesign의 Midjourney modal 출력을 제출하고 CometAPI에서 다음 이미지 편집 단계를 이어가세요.
POST
/
mj
/
submit
/
modal
cURL
curl https://api.cometapi.com/mj/submit/modal \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"taskId": "<task_id>",
"customId": "MJ::Inpaint::1::<custom_id_hash>::SOLO",
"prompt": "a small red lantern on the boat",
"maskBase64": "data:image/png;base64,<your-mask-base64>"
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/mj/submit/modal",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"taskId": "<task_id>",
"customId": "MJ::Inpaint::1::<custom_id_hash>::SOLO",
"prompt": "a small red lantern on the boat",
"maskBase64": "data:image/png;base64,<your-mask-base64>"
},
)
task = response.json()
print(task["code"], task.get("result")) # code 1 means submitted; result is the task idconst response = await fetch("https://api.cometapi.com/mj/submit/modal", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"taskId": "<task_id>",
"customId": "MJ::Inpaint::1::<custom_id_hash>::SOLO",
"prompt": "a small red lantern on the boat",
"maskBase64": "data:image/png;base64,<your-mask-base64>"
}),
});
const task = await response.json();
console.log(task.code, task.result); // code 1 means submitted; result is the task id<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/mj/submit/modal",
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([
'taskId' => '<task_id>',
'customId' => 'MJ::Inpaint::1::<custom_id_hash>::SOLO'
]),
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://api.cometapi.com/mj/submit/modal"
payload := strings.NewReader("{\n \"taskId\": \"<task_id>\",\n \"customId\": \"MJ::Inpaint::1::<custom_id_hash>::SOLO\"\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://api.cometapi.com/mj/submit/modal")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"taskId\": \"<task_id>\",\n \"customId\": \"MJ::Inpaint::1::<custom_id_hash>::SOLO\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/mj/submit/modal")
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 \"taskId\": \"<task_id>\",\n \"customId\": \"MJ::Inpaint::1::<custom_id_hash>::SOLO\"\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"description": "<string>",
"properties": {},
"result": 123
}개요
Action 작업이status: "MODAL"을 반환할 때 추가 입력을 제출합니다. 이는 인페인팅 마스크나 사용자 지정 zoom 프롬프트처럼 추가 데이터가 필요한 작업에 필요합니다.
사용 시점
| 작업 | 제출할 내용 |
|---|---|
| Vary (Region) / Inpaint | maskBase64 (PNG 마스크) + prompt |
| Custom Zoom | prompt (예: “your prompt —zoom 2”) |
전체 인페인트 흐름 예시는 Midjourney API로 시작하기를 참고하세요.
인증
Bearer token authentication. Use your CometAPI key.
본문
application/json
Task id from the parent task whose modal action you are continuing.
The button customId that opened the modal, such as MJ::Inpaint::1::xxxx::SOLO from the Vary (Region) button. Required.
Base64-encoded mask image for partial inpainting. White areas are repainted; black areas are preserved.
Text prompt describing the desired change for the selected region.
⌘I
cURL
curl https://api.cometapi.com/mj/submit/modal \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"taskId": "<task_id>",
"customId": "MJ::Inpaint::1::<custom_id_hash>::SOLO",
"prompt": "a small red lantern on the boat",
"maskBase64": "data:image/png;base64,<your-mask-base64>"
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/mj/submit/modal",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"taskId": "<task_id>",
"customId": "MJ::Inpaint::1::<custom_id_hash>::SOLO",
"prompt": "a small red lantern on the boat",
"maskBase64": "data:image/png;base64,<your-mask-base64>"
},
)
task = response.json()
print(task["code"], task.get("result")) # code 1 means submitted; result is the task idconst response = await fetch("https://api.cometapi.com/mj/submit/modal", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"taskId": "<task_id>",
"customId": "MJ::Inpaint::1::<custom_id_hash>::SOLO",
"prompt": "a small red lantern on the boat",
"maskBase64": "data:image/png;base64,<your-mask-base64>"
}),
});
const task = await response.json();
console.log(task.code, task.result); // code 1 means submitted; result is the task id<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/mj/submit/modal",
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([
'taskId' => '<task_id>',
'customId' => 'MJ::Inpaint::1::<custom_id_hash>::SOLO'
]),
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://api.cometapi.com/mj/submit/modal"
payload := strings.NewReader("{\n \"taskId\": \"<task_id>\",\n \"customId\": \"MJ::Inpaint::1::<custom_id_hash>::SOLO\"\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://api.cometapi.com/mj/submit/modal")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"taskId\": \"<task_id>\",\n \"customId\": \"MJ::Inpaint::1::<custom_id_hash>::SOLO\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/mj/submit/modal")
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 \"taskId\": \"<task_id>\",\n \"customId\": \"MJ::Inpaint::1::<custom_id_hash>::SOLO\"\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"description": "<string>",
"properties": {},
"result": 123
}