Skip to content

Midjourney

Tianshu supports calling Midjourney for image generation via the standard Midjourney proxy API (imagine for text-to-image, upscale for upscaling, variation for variants, etc.). Midjourney models are under the midjourney group.

Prepare

  1. Create a token in the midjourney group in the Console.
  2. Midjourney generation is a long-running task, so use the direct route https://api.tian-shu.org for the endpoint.

Call flow

Midjourney is an asynchronous task: first submit a task to get a task ID, then poll for the task result.

1. Submit a text-to-image task

bash
curl 'https://api.tian-shu.org/mj/submit/imagine' \
  -H 'Authorization: Bearer your-midjourney-group-token' \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt": "a cozy bookstore on a rainy night, warm light, cinematic --ar 16:9 --v 6"
  }'

The response includes a task id.

2. Query the task result

bash
curl 'https://api.tian-shu.org/mj/task/TASK_ID/fetch' \
  -H 'Authorization: Bearer your-midjourney-group-token'

When the task status becomes SUCCESS, the response includes the URL of the finished image (a 2×2 grid).

3. Upscale / variation

Once the grid is ready, use the returned button info to submit follow-up actions (upscale U1–U4, variation V1–V4):

bash
curl 'https://api.tian-shu.org/mj/submit/action' \
  -H 'Authorization: Bearer your-midjourney-group-token' \
  -H 'Content-Type: application/json' \
  -d '{
    "taskId": "the task ID from the previous step",
    "customId": "the button customId returned in the previous step"
  }'

Common prompt parameters

ParameterNotes
--ar 16:9Aspect ratio (e.g. 1:1, 16:9, 9:16).
--v 6Model version.
--nijiAnime-style model.
--style rawMore realistic, less stylized.
--no xxxExclude certain elements.

Using it in a client

Any third-party image client that supports the "Midjourney proxy / midjourney-proxy" format can use:

  • Endpoint: https://api.tian-shu.org
  • API Key: your midjourney group token

For the specific available models and tiers (fast / relax, etc.), refer to the midjourney group on the Model Marketplace.