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
- Create a token in the
midjourneygroup in the Console. - Midjourney generation is a long-running task, so use the direct route
https://api.tian-shu.orgfor 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
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
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):
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
| Parameter | Notes |
|---|---|
--ar 16:9 | Aspect ratio (e.g. 1:1, 16:9, 9:16). |
--v 6 | Model version. |
--niji | Anime-style model. |
--style raw | More realistic, less stylized. |
--no xxx | Exclude 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
midjourneygroup token
For the specific available models and tiers (fast / relax, etc.), refer to the midjourney group on the Model Marketplace.
