Skip to content

Midjourney-Style Interface ​

CoreRouter provides a set of Midjourney-style asynchronous task interfaces. After submitting a task, it typically returns a task ID first, then you use the query interface to get progress, image addresses, and button operations.

These interfaces are not OpenAI Chat Completions interfaces and cannot use messages, input, or regular chat model request formats.

Interface Information ​

ConfigurationValue
Base URLhttps://api.corerouter.cloud
API KeyUse Authorization: Bearer sk-...
Submission Path/mj/submit/...
Query Path/mj/task/{id}/fetch
Model SelectionMapped by operation type to corresponding Midjourney model and channel

Some deployments provide additional paths in the form /{mode}/mj/.... Only use this prefix when the service explicitly provides it; don't add or remove prefixes yourself.

Generate Images ​

/mj/submit/imagine automatically processes as an Imagine operation, prompt is required:

bash
export COREROUTER_API_KEY="sk-xxxxxxxxxxxxxxxx"

curl https://api.corerouter.cloud/mj/submit/imagine \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COREROUTER_API_KEY" \
  -d '{
    "prompt": "A futuristic city floating in a sea of clouds, cinematic, rich details"
  }'

Successful response typically looks like:

json
{
  "code": 1,
  "description": "Submission successful",
  "result": "task-id-from-upstream"
}

result is the task ID used for subsequent queries. Different channels' code, description, and properties may vary; clients shouldn't rely solely on fixed Chinese descriptions to determine success.

Query Task ​

bash
curl https://api.corerouter.cloud/mj/task/task-id-from-upstream/fetch \
  -H "Authorization: Bearer $COREROUTER_API_KEY"

Query results typically include:

FieldDescription
idTask ID
statusTask status, e.g., SUCCESS
progressProgress, e.g., 50%
imageUrlImage address; whether rewritten to gateway proxy address depends on service configuration
buttonsButtons to continue operations like upscale, variant, etc.
failReasonFailure reason

Poll every few seconds; don't make high-frequency requests while task is incomplete.

Execute Operations Based on Buttons ​

Using customId ​

If buttons in query results contain customId, you can directly submit to /mj/submit/action:

bash
curl https://api.corerouter.cloud/mj/submit/action \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COREROUTER_API_KEY" \
  -d '{
    "customId": "MJ::JOB::upsample::2::task-id-from-upstream"
  }'

Button customId must use the actual value returned in query results; don't manually guess task ID combination formats.

Using Regular Transform Parameters ​

/mj/submit/change requires task ID, action, and index:

bash
curl https://api.corerouter.cloud/mj/submit/change \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COREROUTER_API_KEY" \
  -d '{
    "taskId": "task-id-from-upstream",
    "action": "UPSCALE",
    "index": 2
  }'

index is typically 1 to 4; specific available operations are determined by buttons returned from the channel.

If the client uses simplified format, you can also call /mj/submit/simple-change:

bash
curl https://api.corerouter.cloud/mj/submit/simple-change \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COREROUTER_API_KEY" \
  -d '{
    "content": "task-id-from-upstream u2"
  }'

Simplified format supports u1 through u4, v1 through v4, and r for regenerate.

Other Operations ​

EndpointMain UseCommon Fields
/mj/submit/describeReverse engineer prompt from imagebase64Array
/mj/submit/blendMulti-image blendingbase64Array
/mj/submit/editsImage editingbase64Array, maskBase64, prompt
/mj/submit/shortenShorten promptprompt
/mj/submit/modalModal edit or extended operationstaskId, maskBase64, etc., depends on channel
/mj/submit/videoConvert image task to video or video operationtaskId, action
/mj/submit/upload-discord-imagesUpload image to upstreambase64Array
/mj/insight-face/swapFace swapsourceBase64, targetBase64

Image encoding, quantity, prompt parameters, and available actions for these operations are determined by the upstream channel. Fields in documentation are common fields the gateway can recognize, not a substitute for specific channel parameter descriptions.

Batch Query and Image Proxy ​

Batch query:

bash
curl https://api.corerouter.cloud/mj/task/list-by-condition \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $COREROUTER_API_KEY" \
  -d '{
    "ids": ["task-id-1", "task-id-2"]
  }'

If service configuration enables image proxy, you can use:

bash
curl -L https://api.corerouter.cloud/mj/image/task-id-from-upstream \
  -H "Authorization: Bearer $COREROUTER_API_KEY" \
  --output result.jpg

If image proxy is unavailable, use the imageUrl from task query results. Image addresses may be affected by upstream validity period, domain access, and server-side SSRF protection policies.

Compatibility Boundaries and Billing ​

  • Only service instances configured with corresponding Midjourney channels, operations, and model pricing can use these interfaces.
  • Midjourney operations are typically billed per request; when submission fails, balance insufficient, or channel unavailable, don't treat response as successful task.
  • Whether notifyHook works depends on server-side notification configuration; can't treat it as a guaranteed callback capability.
  • Some service configurations remove accountFilter or notifyHook; clients should rely on final task status.
  • Task IDs, button customId, and imageUrl should all use actual interface return values; don't construct them yourself.

Common Issues ​

Returns prompt_is_required ​

/mj/submit/imagine missing non-empty prompt. Confirm you're sending JSON and field name is not message or input.

Returns task_not_found ​

Confirm task ID comes from submission response's result or query result, and using the same API Key and account.

Returns quota_not_enough ​

Account quota insufficient, or fixed price for this operation is not configured. Check console balance and model configuration for the operation.

No Image All Along ​

Midjourney is an asynchronous task. First poll /mj/task/{id}/fetch, confirm status is SUCCESS, then use imageUrl or image proxy address.

Released under the MIT License.