All models

Midjourney: Midjourney MJ

No training

Midjourney Imagine generates images from text prompts through an asynchronous MJ task API. Submit an Imagine task, then poll its ID for progress and the result. Billing is per accepted task, and status queries do not incur another charge. The current integration supports 1K Imagine tasks. Current task prices are shown in the model marketplace. If waiting times out, continue querying the saved task ID to avoid duplicate submissions.

Modalities

Price per task

1KPlatform price $0.079 / taskList $0.8090% off

Context

-

Released

—

Call the Midjourney MJ API

Model ID mj_imagine · replace <TEAMOROUTER_API_KEY> with your API key

Get an API key

MJ task API

#!/usr/bin/env bash
set -euo pipefail
# Requires jq.
BASE_URL="https://api.teamorouter.com"
API_KEY="<TEAMOROUTER_API_KEY>"
# Submit once. On timeout, do not automatically resubmit: the task may already be accepted.
submitted=$(curl --disable --silent --show-error --fail-with-body --retry 0 --max-time 660 \
  "$BASE_URL/mj/submit/imagine" -X POST \
  -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
  --data '{"model":"mj_imagine","botType":"MID_JOURNEY","prompt":"An orange cat typing on a keyboard --ar 1:1"}')
if ! jq -e '(.code == 1 or .code == 22) and ((.result | type) == "string" or (.result | type) == "number")' <<< "$submitted" > /dev/null; then
  printf '%s\n' "$submitted" >&2; exit 1
fi
# Read numeric IDs from the raw JSON to avoid jq number rounding.
task_id=$(printf '%s' "$submitted" | sed -nE 's/.*"result"[[:space:]]*:[[:space:]]*([0-9]+)[[:space:]]*[,}].*/\1/p')
if [ -z "$task_id" ]; then task_id=$(jq -r '.result' <<< "$submitted"); fi
[[ "$task_id" =~ ^[A-Za-z0-9_-]{1,128}$ ]] || { printf '%s\n' "$submitted" >&2; exit 1; }
# Keep task_id. After interruption or polling timeout, resume GET with this ID; do not rerun POST.
printf 'task_id: %s\n' "$task_id"
for ((attempt=0; attempt<120; attempt++)); do
  task=$(curl --disable --silent --show-error --fail-with-body --retry 0 --max-time 60 \
    "$BASE_URL/mj/task/$task_id/fetch" -H "Authorization: Bearer $API_KEY")
  status=$(jq -r '.status' <<< "$task")
  if [ "$status" = "SUCCESS" ]; then
    jq -er '.imageUrl | select(type == "string" and length > 0)' <<< "$task"
    exit 0
  fi
  if [ "$status" = "FAILURE" ] || [ "$status" = "CANCEL" ]; then
    printf 'task_id=%s: %s\n' "$task_id" "$(jq -r '.failReason // .status' <<< "$task")" >&2; exit 1
  fi
  sleep 5
done
printf 'Polling stopped; resume GET for task_id=%s\n' "$task_id" >&2
exit 1

Providers

MJ submits an Imagine task first, then uses its task ID to query progress and results. Queries stay with the channel that accepted the task. An unknown submission outcome is not automatically retried; keep the request ID to reconcile it and avoid duplicate tasks and charges. Configure discount range

Need a specific set of providers?

ProviderContextInputOutputCacheLatencyThroughputNo training
MidjourneyPer task1K$0.079 / taskList $0.8090% off————No training

Uptime

These figures describe Gateway request availability, not the image generation success rate of asynchronous Imagine tasks. Query the task ID for its final status; a wait timeout is not a reason to submit again.

Uptime (24h)

—

Uptime (3d)

—

Uptime, last 3 days

—

-72h-48h-24hNow

Uptime, last 24 hours

Each line shows Gateway request availability for a provider or TeamoRouter, not the final image generation success rate of accepted asynchronous Imagine tasks.

    AVAILABILITY · LAST 24H · TEAMOROUTER GATEWAY

    Data security

    TeamoRouter does not use your data to train models.

    For the full data-security policy, learn more.

    Need to pick your own providers? .

    Quickstart

    import json
    import re
    import time
    import urllib.request
    
    BASE_URL = "https://api.teamorouter.com"
    HEADERS = {"Authorization": "Bearer <TEAMOROUTER_API_KEY>", "Content-Type": "application/json"}
    
    class NoRedirect(urllib.request.HTTPRedirectHandler):
        def redirect_request(self, req, fp, code, msg, headers, newurl):
            return None
    
    http = urllib.request.build_opener(NoRedirect)
    # Submit once. On timeout, do not automatically resubmit: the task may already be accepted.
    request = urllib.request.Request(BASE_URL + "/mj/submit/imagine", data="{\"model\":\"mj_imagine\",\"botType\":\"MID_JOURNEY\",\"prompt\":\"An orange cat typing on a keyboard --ar 1:1\"}".encode(), headers=HEADERS, method="POST")
    with http.open(request, timeout=660) as response:
        submitted = json.load(response)
    result = submitted.get("result")
    task_id = str(result) if type(result) is str or (type(result) is int and result >= 0) else ""
    if type(submitted.get("code")) is not int or submitted["code"] not in (1, 22) or not re.fullmatch(r"[A-Za-z0-9_-]{1,128}", task_id):
        raise RuntimeError(f"Not accepted: {submitted}")
    # Keep task_id. After interruption or polling timeout, resume GET with this ID; do not rerun POST.
    print("task_id:", task_id, flush=True)
    for _ in range(120):
        request = urllib.request.Request(BASE_URL + "/mj/task/" + task_id + "/fetch", headers=HEADERS)
        with http.open(request, timeout=60) as response:
            task = json.load(response)
        if task.get("status") == "SUCCESS":
            if not task.get("imageUrl"):
                raise RuntimeError(f"Missing imageUrl; task_id={task_id}")
            print(task["imageUrl"])
            break
        if task.get("status") in ("FAILURE", "CANCEL"):
            raise RuntimeError(f"task_id={task_id}: {task.get('failReason') or task['status']}")
        time.sleep(5)
    else:
        raise TimeoutError(f"Polling stopped; resume GET for task_id={task_id}")

    Endpoint: https://api.teamorouter.com

    About Midjourney MJ

    Midjourney MJ is a Midjourney model. On TeamoRouter its model ID is mj_imagine, and the same TeamoRouter API key works for it and every other model. Setup steps are in the API docs.

    Model ID
    mj_imagine
    Provider
    Midjourney
    Standard list price
    $0.80 per accepted task

    Use the Midjourney MJ API

    Submit an Imagine task once, save its ID, then poll for the generated image. Python example:

    import json
    import re
    import time
    import urllib.request
    
    BASE_URL = "https://api.teamorouter.com"
    HEADERS = {"Authorization": "Bearer <TEAMOROUTER_API_KEY>", "Content-Type": "application/json"}
    
    class NoRedirect(urllib.request.HTTPRedirectHandler):
        def redirect_request(self, req, fp, code, msg, headers, newurl):
            return None
    
    http = urllib.request.build_opener(NoRedirect)
    # Submit once. On timeout, do not automatically resubmit: the task may already be accepted.
    request = urllib.request.Request(BASE_URL + "/mj/submit/imagine", data="{\"model\":\"mj_imagine\",\"botType\":\"MID_JOURNEY\",\"prompt\":\"An orange cat typing on a keyboard --ar 1:1\"}".encode(), headers=HEADERS, method="POST")
    with http.open(request, timeout=660) as response:
        submitted = json.load(response)
    result = submitted.get("result")
    task_id = str(result) if type(result) is str or (type(result) is int and result >= 0) else ""
    if type(submitted.get("code")) is not int or submitted["code"] not in (1, 22) or not re.fullmatch(r"[A-Za-z0-9_-]{1,128}", task_id):
        raise RuntimeError(f"Not accepted: {submitted}")
    # Keep task_id. After interruption or polling timeout, resume GET with this ID; do not rerun POST.
    print("task_id:", task_id, flush=True)
    for _ in range(120):
        request = urllib.request.Request(BASE_URL + "/mj/task/" + task_id + "/fetch", headers=HEADERS)
        with http.open(request, timeout=60) as response:
            task = json.load(response)
        if task.get("status") == "SUCCESS":
            if not task.get("imageUrl"):
                raise RuntimeError(f"Missing imageUrl; task_id={task_id}")
            print(task["imageUrl"])
            break
        if task.get("status") in ("FAILURE", "CANCEL"):
            raise RuntimeError(f"task_id={task_id}: {task.get('failReason') or task['status']}")
        time.sleep(5)
    else:
        raise TimeoutError(f"Polling stopped; resume GET for task_id={task_id}")

    Midjourney MJ FAQ

    What is the Midjourney MJ API model ID?
    The model ID is mj_imagine. Submit once to https://api.teamorouter.com/mj/submit/imagine, then query /mj/task/{task_id}/fetch with the returned task ID. Each accepted Imagine task is billed once.
    How much does the Midjourney MJ API cost?
    The standard list price is $0.80 per accepted task. Task queries do not incur another Imagine charge. See the price table for your applicable rate.
    How do I pay for the Midjourney MJ API?
    New accounts start with a $0 balance. Top up from $5 by card in the TeamoRouter dashboard, then usage is deducted per request, with no subscription. Top up.
    Can I pay for the Midjourney MJ API with USDT?
    Yes. In the top-up dialog, click "Pay with crypto" and send USDT, USDC or ETH from Binance, OKX or any wallet. The minimum is $5 and no browser extension is needed. Step by step: how to pay for the API with USDT.