curl --request POST \
--url https://kaienapi.com/mj/submit/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"taskId": "task_xxx",
"prompt": "replace the background",
"maskBase64": "data:image/png;base64,..."
}
'{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}Midjourney 局部编辑
对已有图片做局部编辑。
请求格式
传入原任务 taskId、编辑 prompt 和 maskBase64。mask 标记需要修改的区域。
指令写法
常见任务包括替换背景、调整局部元素或修复画面细节。大面积重画时,重新提交 imagine 通常更清晰。
POST
/
mj
/
submit
/
edits
curl --request POST \
--url https://kaienapi.com/mj/submit/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"taskId": "task_xxx",
"prompt": "replace the background",
"maskBase64": "data:image/png;base64,..."
}
'{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}Authorizations
在请求头中传入:Authorization: Bearer sk-...
Body
application/json
Midjourney 兼容请求。提交类接口返回任务 ID,随后用任务查询接口获取最终结果。
提示词。比例、风格、质量等 Midjourney 参数写入 prompt,例如 --ar 16:9。
Example:
"a cinematic robot portrait"
已有任务 ID。放大、变体、局部编辑、视频延展和查询任务时传入。
Example:
"task_xxx"
基于已有任务的操作类型,例如 UPSCALE、VARIATION、REROLL。
Example:
"UPSCALE"
自定义动作 ID。按返回按钮或动作标识继续提交时传入。
Example:
"MJ::JOB::upsample::1::abcd"
四宫格中的图片序号,一般为 1 到 4。
Example:
1
任务筛选状态。按条件查询任务列表时传入。
简化操作内容,例如 U1 task_xxx。
图片 base64 数组。describe、blend 和图片上传类接口会读取该字段。
局部编辑遮罩图 base64,用来标记需要重绘的区域。
回调地址。任务状态变化时可接收通知,是否生效以接口说明为准。
Response
成功响应
The response is of type object.