cURL
curl --request POST \
--url https://api.ttapi.io/midjourney/image-edits/submit \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"prompt": "<string>",
"image": "https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png",
"mode": "fast",
"type": "edit",
"hookUrl": "<string>"
}
'import requests
url = "https://api.ttapi.io/midjourney/image-edits/submit"
payload = {
"prompt": "<string>",
"image": "https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png",
"mode": "fast",
"type": "edit",
"hookUrl": "<string>"
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
image: 'https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png',
mode: 'fast',
type: 'edit',
hookUrl: '<string>'
})
};
fetch('https://api.ttapi.io/midjourney/image-edits/submit', 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://api.ttapi.io/midjourney/image-edits/submit",
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([
'prompt' => '<string>',
'image' => 'https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png',
'mode' => 'fast',
'type' => 'edit',
'hookUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-API-KEY: <api-key>"
],
]);
$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.ttapi.io/midjourney/image-edits/submit"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"image\": \"https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png\",\n \"mode\": \"fast\",\n \"type\": \"edit\",\n \"hookUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-API-KEY", "<api-key>")
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.ttapi.io/midjourney/image-edits/submit")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"image\": \"https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png\",\n \"mode\": \"fast\",\n \"type\": \"edit\",\n \"hookUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/midjourney/image-edits/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"image\": \"https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png\",\n \"mode\": \"fast\",\n \"type\": \"edit\",\n \"hookUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"jobId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"status": "FAILED",
"message": "\"prompt\" cannot be empty.",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}Midjourney Edit
编辑图像
根据图像与描述词生成四张图像,该接口为异步任务
POST
/
midjourney
/
image-edits
/
submit
cURL
curl --request POST \
--url https://api.ttapi.io/midjourney/image-edits/submit \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"prompt": "<string>",
"image": "https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png",
"mode": "fast",
"type": "edit",
"hookUrl": "<string>"
}
'import requests
url = "https://api.ttapi.io/midjourney/image-edits/submit"
payload = {
"prompt": "<string>",
"image": "https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png",
"mode": "fast",
"type": "edit",
"hookUrl": "<string>"
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
image: 'https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png',
mode: 'fast',
type: 'edit',
hookUrl: '<string>'
})
};
fetch('https://api.ttapi.io/midjourney/image-edits/submit', 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://api.ttapi.io/midjourney/image-edits/submit",
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([
'prompt' => '<string>',
'image' => 'https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png',
'mode' => 'fast',
'type' => 'edit',
'hookUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-API-KEY: <api-key>"
],
]);
$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.ttapi.io/midjourney/image-edits/submit"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"image\": \"https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png\",\n \"mode\": \"fast\",\n \"type\": \"edit\",\n \"hookUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-API-KEY", "<api-key>")
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.ttapi.io/midjourney/image-edits/submit")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"image\": \"https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png\",\n \"mode\": \"fast\",\n \"type\": \"edit\",\n \"hookUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/midjourney/image-edits/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"image\": \"https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png\",\n \"mode\": \"fast\",\n \"type\": \"edit\",\n \"hookUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"jobId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"status": "FAILED",
"message": "\"prompt\" cannot be empty.",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}由于Midjourney官方编辑图片自带裁剪功能,所以实际支持的可编辑图片有固定比例,目前支持的比例范围为 1:1, 1:2, 2:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9,如上传图片不在给定比例范围内,系统会自动调整至合适比例生成新图。
请求体
application/json
用于修改图片的提示,Midjourney支持多语言,实测英文效果最佳。
图像文件 支持 url 和 base64 文件,仅支持 png, jpg, jpeg, bmp, webp
注意:图片中需要修改的部分为透明区域,如示例所示。
可用选项:
https://cdn.ttapi.io/other/2025-07-28/2ace47ac-5cf0-41bb-b1eb-3e47f2a46f35.png 编辑图片的速率模式
可用选项:
relax, fast, turbo 编辑类型
可用选项:
edit, retexture 回调地址,任务完成或失败将通过请地址进行通知,如果未设置,则需要请求 获取任务状态接口 [blocked]进行查询
最后修改于 2026年3月13日
⌘I