Modal (submit parameters)
Supply mask + prompt to complete a MODAL-state inpaint task
Вся документацияPOST
/v1/midjourney/generations/modal{
"error": {
"code": 500,
"message": "Internal server error. Please try again later",
"type": "server_error"
}
}{
"error": {
"code": 502,
"message": "Bad gateway. The server is temporarily unavailable",
"type": "bad_gateway"
}
}Complete a MODAL-state inpaint task by supplying a mask + prompt. The system auto-detects the mode by whether mask_url is present: with mask_url → inpaint (local repaint); without → outpaint (expand).
| Item | Value |
|---|---|
| action | MODAL |
| Billing | midjourney@modal[-speed] |
| Required | task_id |
| Optional | prompt, mask_url, speed, metadata |
Примеры запросов
curl --request POST \
--url https://api.apisea.ai/v1/midjourney/generations/modal \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"task_id": "task_01KQW1N9T6E3AHW6QZFDEK8M5C",
"prompt": "replace the selected area with a red leather sofa",
"mask_url": "https://example.com/mask.png",
"speed": "fast"
}'Parameters
| Field | Description |
|---|---|
task_id | Local task id returned by the inpaint step (must be in MODAL state) |
nsfw_check | boolean — Optional; defaults to false. Run content moderation before submitting a Midjourney task. • true: use omni-moderation-latest to review prompts and input images • false: skip moderation without adding moderation cost or latency |
prompt | Inpaint prompt; if empty, inherits the parent task's prompt |
mask_url | Mask image URL or base64; required for inpaint (local repaint). Transparent = the area to repaint, white = keep the original |
speed | relax / fast / turbo |
metadata | Optional custom metadata |
Mask requirements
| Item | Recommendation |
|---|---|
| Format | PNG with transparent background (also accepts data:image/png;base64,...) |
| Resolution | Preferably same as the parent image (the system also auto-resizes) |
| Transparent area | The area to repaint; white areas keep the original |
| Size | ≤ 12 MiB per image |
| URL | Must be publicly reachable (private addresses are blocked by SSRF) |
Request example
{
"task_id": "task_01KQW1N9T6E3AHW6QZFDEK8M5C",
"prompt": "replace the selected area with a red leather sofa",
"mask_url": "https://example.com/mask.png",
"speed": "fast"
}Response
The task_id stays the same (same task); its status goes from MODAL → SUBMITTED. Poll GET /v1/tasks/{task_id}; on SUCCESS image_urls holds 4 inpaint candidates. Billing settles on this endpoint's SUCCESS and is not double-charged with the inpaint step.
To price by speed, configure midjourney@modal-fast / midjourney@modal-turbo.
Ответы
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01KV52C0TEJSYZMCG0NCS4YWKK"
}
]
}Нашли ошибку в документации? Напишите на support@apisea.ai.