Midjourney / MJ API
規劃中
在已設定的情況下,使用相容 Midjourney 的提交、取得、圖片和任務輔助路由。
POST /mj/submit/imagine
提交 Midjourney imagine 任務。範例使用所選的最新模型文件範例 mj_imagine,並包含 Midjourney 請求 DTO 的全部欄位。
MJ imagine 產生
curl https://www.token168.cc/mj/submit/imagine \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"prompt": "A clean product render --v 8 --ar 16:9",
"customId": "",
"botType": "MID_JOURNEY",
"notifyHook": "",
"action": "IMAGINE",
"index": 1,
"state": "client-trace-123",
"taskId": "",
"base64Array": [],
"content": "",
"maskBase64": ""
}'
POST /mj/submit/change
針對已有 MJ 任務提交放大或變體操作。
MJ 變更
curl https://www.token168.cc/mj/submit/change \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"taskId": "mj_task_123",
"action": "UPSCALE",
"index": 1,
"customId": "MJ::JOB::upsample::1",
"state": "client-trace-123",
"content": ""
}'
POST /mj/submit/action 及相關提交路由
Action、shorten、modal、simple-change、describe、blend、edits、video 和 upload-discord-images 路由共用同一 Midjourney 請求結構,並從路徑或請求內容設定 action。
MJ 提交路由範例
curl https://www.token168.cc/mj/submit/action \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"taskId": "mj_task_123",
"action": "VARIATION",
"index": 1,
"customId": "MJ::JOB::variation::1",
"state": "client-trace-123",
"content": ""
}'
curl https://www.token168.cc/mj/submit/shorten \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"prompt": "A long Midjourney prompt to shorten --v 8",
"state": "client-trace-123",
"botType": "MID_JOURNEY"
}'
curl https://www.token168.cc/mj/submit/modal \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"taskId": "mj_task_123",
"customId": "MJ::JOB::modal",
"prompt": "Adjust the modal prompt",
"maskBase64": "",
"state": "client-trace-123"
}'
curl https://www.token168.cc/mj/submit/simple-change \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"taskId": "mj_task_123",
"action": "UPSCALE",
"index": 2,
"state": "client-trace-123"
}'
curl https://www.token168.cc/mj/submit/describe \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"base64Array": ["data:image/png;base64,..."],
"state": "client-trace-123",
"botType": "MID_JOURNEY"
}'
curl https://www.token168.cc/mj/submit/blend \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"base64Array": ["data:image/png;base64,...", "data:image/png;base64,..."],
"dimensions": "SQUARE",
"state": "client-trace-123",
"botType": "MID_JOURNEY"
}'
curl https://www.token168.cc/mj/submit/edits \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"prompt": "Replace the background with a clean studio wall",
"taskId": "mj_task_123",
"maskBase64": "data:image/png;base64,...",
"state": "client-trace-123",
"botType": "MID_JOURNEY"
}'
curl https://www.token168.cc/mj/submit/video \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"taskId": "mj_task_123",
"prompt": "Animate this frame with a slow camera move",
"image": "https://example.com/frame.png",
"state": "client-trace-123",
"botType": "MID_JOURNEY"
}'
curl https://www.token168.cc/mj/submit/upload-discord-images \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"base64Array": ["data:image/png;base64,..."],
"state": "client-trace-123",
"botType": "MID_JOURNEY"
}'
| 方法 | 路徑 | 狀態 |
|---|---|---|
| POST | /mj/submit/action | 規劃中 / 受部署設定限制 |
| POST | /mj/submit/shorten | 規劃中 / 受部署設定限制 |
| POST | /mj/submit/modal | 規劃中 / 受部署設定限制 |
| POST | /mj/submit/change | 規劃中 / 受部署設定限制 |
| POST | /mj/submit/simple-change | 規劃中 / 受部署設定限制 |
| POST | /mj/submit/describe | 規劃中 / 受部署設定限制 |
| POST | /mj/submit/blend | 規劃中 / 受部署設定限制 |
| POST | /mj/submit/edits | 規劃中 / 受部署設定限制 |
| POST | /mj/submit/video | 規劃中 / 受部署設定限制 |
| POST | /mj/submit/upload-discord-images | 規劃中 / 受部署設定限制 |
GET /mj/task/{id}/fetch
依任務 ID 取得目前 API Key 使用者的一筆 MJ 任務。
取得 MJ 任務
curl https://www.token168.cc/mj/task/mj_task_123/fetch \
-H "Authorization: Bearer $TOKEN168_API_KEY"
POST /mj/task/list-by-condition
依條件列出 MJ 任務。當供應商存取已設定時,可用於主控台輪詢或搜尋。
依條件列出 MJ 任務
curl https://www.token168.cc/mj/task/list-by-condition \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"mj_id": "mj_task_123",
"action": "IMAGINE",
"status": "SUCCESS"
}'
GET /mj/task/{id}/image-seed 與 GET /mj/image/{id}
MJ 路由群組提供圖片 seed 和圖片代理輔助路由。這些路由使用路徑參數和同一套 API Key 驗證。
MJ 圖片輔助 API
curl https://www.token168.cc/mj/task/mj_task_123/image-seed \
-H "Authorization: Bearer $TOKEN168_API_KEY"
curl https://www.token168.cc/mj/image/image_123 \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
--output mj-image.png
| 方法 | 路徑 | 狀態 |
|---|---|---|
| GET | /mj/task/{id}/image-seed | 規劃中 / 受部署設定限制 |
| GET | /mj/image/{id} | 規劃中 / 受部署設定限制 |
POST /mj/insight-face/swap
當部署啟用對應能力時,透過 MJ 路由群組提交 InsightFace 換臉輔助請求。
MJ InsightFace 換臉
curl https://www.token168.cc/mj/insight-face/swap \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN168_API_KEY" \
-d '{
"sourceBase64": "data:image/png;base64,...",
"targetBase64": "data:image/png;base64,...",
"state": "client-trace-123"
}'