MJ endpoint provide image, image, Image-to-Video, video etc. Capability, task ()Model:endpoint after returnjobId, query endpointPollingTask Status.
will/aigc/mjendpointas endpoint (/mj/v1/tob/*), Path.localized example text/aigc/mjendpointlocalized example text.
Base URL: https://mm-internal-cn.leonecloud.com
Authentication
with endpoint in Request in API Key:```
Authorization: Bearer {YOUR_API_KEY}
---
## (endpoint)
with endpoint (image / video) return task:| field | Type | Description |
|------|------|------|
| jobId | string | Task ID, after query or|
| comment | string | Task Status, localized example text「Task Status」localized example text|
| reason | string | Failure(onlytaskFailurereturned when applicable, )|
| text | string | Prompt (imagetaskreturn )|
| urls | string[] | imageURL list (imagetask)|
| videoUrls | string[] | videoURL list (videotask)|
| cost | number |, task complete after|
| createdAt | string | Created Time (query endpoint return )|
| finishedAt | string | complete when ( query endpoint return )|
> Create Taskwhen`comment` as`JobStatusCreated`, `urls` / `videoUrls` as,`cost` as 0.localized example text「Query Tasklocalized example text」endpointlocalized example text.
**create SuccessResponse Example**
```json{
"jobId": "task_20260529150000_abc12345",
"comment": "JobStatusCreated",
"text": "can in,",
"urls": [],
"cost": 0
}
---
## Errorlocalized example text```json
{
"code": 400,
"message": "Invalid_Argument",
"reason": "Request Parametersno:..."
}| field | Type | Description |
|---|---|---|
| code | int | Error Codes |
| message | string | Errorlocalized example text |
| reason | string | Failurelocalized example text |
Error Codes「Error Codes」localized example text.
endpointlocalized example text| localized example text| endpoint | Method | Path |
|------|------|------|------|
| Image Generation | image| POST | /api/v2/open/mj/v1/tob/diffusion |
| Image Generation | localized example text| POST | /api/v2/open/mj/v1/tob/variation |
| Image Generation | height| POST | /api/v2/open/mj/v1/tob/upscale |
| Image Generation | execute| POST | /api/v2/open/mj/v1/tob/reroll |
| Image Generation | localized example text| POST | /api/v2/open/mj/v1/tob/pan |
| Image Generation | image| POST | /api/v2/open/mj/v1/tob/outpaint |
| Image Generation | repainting| POST | /api/v2/open/mj/v1/tob/inpaint |
| Image Generation | localized example text| POST | /api/v2/open/mj/v1/tob/remix |
| Image Generation | localized example text| POST | /api/v2/open/mj/v1/tob/edit |
| Image Generation | height| POST | /api/v2/open/mj/v1/tob/upload-paint |
| Image Generation | localized example text| POST | /api/v2/open/mj/v1/tob/retexture |
| Image Generation | localized example text| POST | /api/v2/open/mj/v1/tob/remove-background |
| Image Generation | localized example text| POST | /api/v2/open/mj/v1/tob/enhance |
| Video Generation | Image-to-Video | POST | /api/v2/open/mj/v1/tob/video-diffusion |
| Video Generation | videolocalized example text| POST | /api/v2/open/mj/v1/tob/extend-video |
| Video Generation | videoheight| POST | /api/v2/open/mj/v1/tob/video-upscale |
| taskquery| Query Tasklocalized example text| GET | /api/v2/open/mj/v1/tob/job/{jobId} |
##, Image Generationendpoint### 1.1 imagePOST /api/v2/open/mj/v1/tob/diffusion
image endpoint.Prompt, Parameter, Reference image URLtext field( and Prompt, can in in image and--ar, --v etc. Parameter).localized example texttext in image when Image-to-Image, Text-to-Image.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Prompt, supported, image URL, Parameter |
| callback | string | No | Callback URL |
Request Example
{
"text": "can in, --ar 16:9 --v 7",
"callback": "https://your-domain.com/callback"
}use Scenariotext field, Scenario ([] Optional, Request in Not required):| Scenario | text fieldFormat | Description |
|------|--------------|------|
| image| localized example text[--Parameter] | onlyimage|
| image+ localized example text| imageURL localized example text[--Parameter] | reference images image, image|
| image| imageURL1 imageURL2 [--Parameter] | multiple imagesimage and ( no )|
| image+ localized example text| imageURL1 imageURL2 localized example text[--Parameter] | multiple imagesReference imagelocalized example text|
| characterreference| --cref imageURL | in image in character,,|
| reference| --sref imageURL | Reference image (,, )|
| localized example text| --oref imageURL | will Reference image in the character or Scenario (only v7)|
textin canhttp:///https://imageImage-to-Image; image can.image aslocalized example text, no Reference image, Pricing (task, image), only.
Parameter
Parameter intext in, and Prompt, image,--ar 16:9 --v 7 --cref https://.../face.jpg --cw 80.
| Parameter | Description | value range |
|---|---|---|
--ar | Aspect ratio | localized example text16:9, 1:1, 2:3 |
--v | Modellocalized example text | 6 / 6.1 / 7 / 8.1 / 8.2 |
--niji | Model ( and--v ) | 6 / 7 |
--iw | image, Reference image | 0-3 (Niji 7 as 0-2), default 1 |
--cref | characterReference image URL | supported v6 / v6.1 / Niji 6 |
--cw | characterreference | 0-100, default 100 |
--sref | Reference image URL ( can ) | supported image Model |
--sw | reference | 0-1000, default 100 |
--sv | localized example text | 1-4 (v7 supported 1-6), default 4 |
--oref | image URL (only 1 images ) | only v7 |
--ow | localized example text | 1-1000, default 100 |
Parameter,; ParameterFormatError when task willJobStatusBadPrompt/JobStatusInvalidParameterStatusreturn,.
(--v Parameter)
Modelintext in--v Parameter, in Prompt can, can and--ar, --sref etc. Parameter.not--v when use default.
| localized example text | localized example text | Description |
|---|---|---|
--v 6 / --v 6.1 | v6 / v6.1 | localized example text |
--v 7 | v7 | supported (--oref), image |
--v 8.1 | v8.1 | , Prompt, supported 2K height (--hd), --q onlysupported1 / 4 |
--v 8.2 | v8.2 | and v8.1 Capability,--q supported1 / 2 / 3 / 4 |
use:
{
"text": "young elven hunter with moss-woven armor, soft forest light --ar 2:3 --raw --v 8.2 --hd",
"callback": "https://your-domain.com/callback"
}- in--vafter,--v 8.2; localized example text--vdefault.
- v8.1 and v8.2:v8.1 localized example text--q(image quality)only supported1and4, v8.2 as1/2/3/4(4as height quality).
Model (--niji Parameter)
Niji and, in character, and.localized example text--niji,and--v localized example text (when when as, recommended).
| localized example text | localized example text | Description |
|---|---|---|
--niji 6 | Niji 6 | supported character reference (--cref / --cw), --q localized example text0.25 / 0.5 / 1 |
--niji 7 | Niji 7 | characterand character, can in and height |
use:
{
"text": ",,, --niji 7 --ar 2:3 --stylize 300",
"callback": "https://your-domain.com/callback"
}and v Parameter:
| Parameter | Niji 6 | Niji 7 |
|---|---|---|
--q quality | 0.25 / 0.5 / 1 | supported |
--cref / --cw characterreference | supported,--cw 0-100 | supported |
--sv localized example text | 1 / 2 / 3 / 4 | 4 / 5 / 6 |
--iw image | 0-3 | 0-2 |
--hd 2K | supported | supported |
--draft image | supported | supported |
--oref / --exp | supported | supported |
- Niji and vlocalized example text, ().
---sref(reference ),--sw,--ar,--raw,--stylize,--chaos,--seed,--noand Parameter in Niji can use.
- Niji (,, etc. ) and v, task and.
v8 (v8.1 / v8.2)with Parameter
v8.1 and v8.2 in v7 ParameterCapability, intext in: | Parameter | Description | value range | localized example text |
|---|---|---|---|---|
--hd | 2K height, output height Resolution, task 4 images height image | no | 1.5× localized example text | |
--q | image quality,4 as height quality | v8.1:1 / 4; v8.2:1 / 2 / 3 / 4, default 1 | localized example text | |
--raw | , default | no | localized example text | |
--stylize | localized example text | 0-1000, default 100 | localized example text | |
--exp | Parameter, | 0-100, default 0 | localized example text | |
--draft | 24 images 0.5K image, | no | as 1 (v8 image v7 0.5× ) |
- v8 height image--hd( 2K), use「height」endpoint, task 4 images height image.
---qand reference (--sref/ Moodboard)localized example text.
- v8 v7--srefreference and Moodboard, with can.
- v8 localized example text「image」task (,, etc. ) and v7.
()
intext in Parameter,.not when defaultlocalized example text.
| Parameter | localized example text | localized example text | Description |
|---|---|---|---|
--fast | (default) | 1× | default, Parameter when as |
--turbo | localized example text | 2× | image, |
--draft | image | 0.5× (only --v 7) | ; v8 can use--draft (24 images ), as 1 ().Niji supported image |
--relax | localized example text | 1× | ( no ) |
- Parameter and--ar,--vetc. intextin, can and Parameter,... --ar 16:9 --v 7 --turbo.
- (,, etc. ), task.
- as, as.:"text": "--ar 16:9 --v 7 --turbo"(, 2× )#### Response Example
{
"jobId": "task_20260529150000_abc12345",
"comment": "JobStatusCreated",
"text": "can in, --ar 16:9 --v 7",
"urls": [],
"cost": 0
}1.2 (Variation)**POST** /api/v2/open/mj/v1/tob/variation
image in the images,.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | Task ID |
| imageNo | int | Yes | image (1-4) |
| type | int | Yes | :0 /1 localized example text |
| remixPrompt | string | No | Prompt |
| callback | string | No | Callback URL |
Request Example
{
"jobId": "task_20260529150000_abc12345",
"imageNo": 1,
"type": 1,
"remixPrompt": "Scenario"
}1.3 height (Upscale)**POST** /api/v2/open/mj/v1/tob/upscale
image height.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | Task ID |
| imageNo | int | Yes | image (1-4) |
| type | int | Yes | :0 /1 /2 v5_2x / 3 v5_4x |
| callback | string | No | Callback URL |
Request Example
{
"jobId": "task_20260529150000_abc12345",
"imageNo": 1,
"type": 0
}1.4 execute (Reroll)**POST** /api/v2/open/mj/v1/tob/reroll
task Parameterimage.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | Task ID |
| callback | string | No | Callback URL |
Request Example
{
"jobId": "task_20260529150000_abc12345"
}1.5 (Pan)**POST** /api/v2/open/mj/v1/tob/pan
and.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | Task ID |
| imageNo | int | Yes | image (1-4) |
| direction | int | Yes | :0 /1 /2 /3 localized example text |
| scale | number | Yes | (1.1-3.0) |
| remixPrompt | string | No | Prompt |
| callback | string | No | Callback URL |
Request Example
{
"jobId": "task_20260529150000_abc12345",
"imageNo": 1,
"direction": 1,
"scale": 1.5,
"remixPrompt": "localized example text"
}1.6 image (Outpaint)**POST** /api/v2/open/mj/v1/tob/outpaint
in image.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | Task ID |
| imageNo | int | Yes | image (1-4) |
| scale | number | Yes | (1.1-2.0) |
| remixPrompt | string | No | image Prompt |
| callback | string | No | Callback URL |
Request Example
{
"jobId": "task_20260529150000_abc12345",
"imageNo": 1,
"scale": 2.0
}1.7 repainting (Inpaint)**POST** /api/v2/open/mj/v1/tob/inpaint
Mask repainting.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | Task ID |
| imageNo | int | Yes | image (1-4) |
| mask | object | Yes | Mask(areas, orurl Maskimage, ) |
| remixPrompt | string | No | repainting |
| callback | string | No | Callback URL |
mask localized example text (areas andurl ): | field | Type | Description |
|---|---|---|---|
| areas | array | list,width, height andpoints (,x1,y1,x2,y2,... ) | |
| url | string | Maskimage URL (Mask, as repainting ) |
Request Example
Method:```json
{
"jobId": "task_20260529150000_abc12345",
"imageNo": 1,
"mask": {
"areas": [
{
"width": 100,
"height": 100,
"points": [10, 10, 10, 100, 100, 100, 100, 10]
}
]
},
"remixPrompt": "localized example text"
}
Maskimage Method:```json
{
"jobId": "task_20260529150000_abc12345",
"imageNo": 1,
"mask": { "url": "https://example.com/mask.png" },
"remixPrompt": "localized example text"
}1.8 (Remix)**POST** /api/v2/open/mj/v1/tob/remix
Promptimage.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | Task ID |
| imageNo | int | Yes | image (1-4) |
| remixPrompt | string | Yes | Prompt |
| mode | int | No | :0 (default) /1 localized example text |
| callback | string | No | Callback URL |
Request Example
{
"jobId": "task_20260529150000_abc12345",
"imageNo": 1,
"remixPrompt": "as",
"mode": 0
}1.9 (Edit)**POST** /api/v2/open/mj/v1/tob/edit
in and image Locationimage.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | Task ID |
| imageNo | int | Yes | image (1-4) |
| canvas | object | Yes | dimensions |
| imgPos | object | Yes | image Location |
| remixPrompt | string | Yes | localized example text |
| mask | object | No | image repainting |
| callback | string | No | Callback URL |
canvas localized example text:
| field | Type | Description |
|---|---|---|
| width | int | width () |
| height | int | height () |
| imgPos localized example text (image in in the Location and dimensions ): | field | Type | Description |
|---|---|---|---|
| width | int | image width () | |
| height | int | image height () | |
| x | int | (, ) | |
| y | int | (, ) |
Request Example
{
"jobId": "task_20260529150000_abc12345",
"imageNo": 1,
"canvas": { "width": 1024, "height": 1024 },
"imgPos": { "width": 1024, "height": 768, "x": 0, "y": 0 },
"remixPrompt": "in"
}1.10 height (Upload Paint)**POST** /api/v2/open/mj/v1/tob/upload-paint
image URL and Mask,, image Location ( no task).
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| imgUrl | string | Yes | image URL |
| mask | object | Yes | Mask(「repainting」mask) |
| canvas | object | Yes | dimensions (「localized example text」canvas) |
| imgPos | object | Yes | image Location (「localized example text」imgPos) |
| remixPrompt | string | Yes | localized example text |
| callback | string | No | Callback URL |
Request Example
{
"imgUrl": "https://example.com/source.jpg",
"mask": { "url": "https://example.com/mask.png" },
"canvas": { "width": 1024, "height": 1024 },
"imgPos": { "width": 1024, "height": 1024, "x": 0, "y": 0 },
"remixPrompt": "as"
}1.11 (Retexture)**POST** /api/v2/open/mj/v1/tob/retexture
image, /.can inremixPrompt in--sref image URL localized example text.use v6.1 and Model.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| imgUrl | string | Yes | image URL |
| remixPrompt | string | Yes | localized example text |
| callback | string | No | Callback URL |
Request Example
{
"imgUrl": "https://example.com/source.jpg",
"remixPrompt": "as"
}1.12 (Remove Background)**POST** /api/v2/open/mj/v1/tob/remove-background
image, output image.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| imgUrl | string | Yes | image URL |
| callback | string | No | Callback URL |
Request Example
{
"imgUrl": "https://example.com/source.jpg"
}1.13 (Enhance)**POST** /api/v2/open/mj/v1/tob/enhance
image.onlylocalized example textimage (--draft) image.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | Task ID |
| imageNo | int | Yes | image (1-4) |
| callback | string | No | Callback URL |
Request Example
{
"jobId": "task_20260529150000_abc12345",
"imageNo": 1
}##, Video Generationendpoint### 2.1 Image-to-Video (Video Diffusion)
POST /api/v2/open/mj/v1/tob/video-diffusion
Image Generationvideo.supported image,:
-localized example text:imagetaskjobId + imageNo (1-4), image as video first frame;
-localized example text:inprompt in provide image.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Condition | imageTask ID (, andprompt in the image) |
| imageNo | int | No | image1-4 (localized example textjobId use, images image as first frame ) |
| prompt | string | Condition | Prompt; in in image |
| videoType | int | No | videoResolution:0 as 480p (default) /1 as 720p |
| callback | string | No | Callback URL |
Duration as 5 seconds.videofirst frame image,:| image| videolocalized example text| Resolutionlocalized example text|
|----------|----------|-----------|
| 1:1 | 1:1 | 624×624 |
| 4:3 | 77:58 | 720×544 |
| 2:3 | 2:3 | 512×768 |
| 16:9 | 91:51 | 832×464 |
720p (videoType=1)as 480p 3.2, as.Request Example
(image):```json
{
"jobId": "task_20260529150000_abc12345",
"imageNo": 1,
"prompt": "in the",
"videoType": 1
}
(prompt in image):```json
{
"prompt": "https://example.com/source.jpg in the",
"videoType": 0
}Response Example
{
"jobId": "task_20260529160000_def67890",
"comment": "JobStatusCreated",
"videoUrls": [],
"cost": 0
}2.2 video(Extend Video)**POST** /api/v2/open/mj/v1/tob/extend-video
in video.4 seconds, up to can 4 ( maximum 21 seconds:5+ 4×4).
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | videoTask ID |
| videoNo | int | Yes | videolocalized example text |
| prompt | string | Yes | localized example text |
| callback | string | No | Callback URL |
Request Example
{
"jobId": "task_20260529160000_def67890",
"videoNo": 0,
"prompt": "first"
}2.3 videoheight (Video Upscale)**POST** /api/v2/open/mj/v1/tob/video-upscale
video height, output 1080P video (videoDuration).
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | videoTask ID |
| videoNo | int | Yes | videolocalized example text |
| callback | string | No | Callback URL |
Request Example
{
"jobId": "task_20260529160000_def67890",
"videoNo": 0
}##, task query endpoint### 3.1 Query Tasklocalized example textGET /api/v2/open/mj/v1/tob/job/{jobId}
query task Statusand result, Polling.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobId | string | Yes | Task ID |
Response Example
processing
{
"jobId": "task_20260529150000_abc12345",
"comment": "JobStatusRunning",
"text": "can in,",
"urls": [],
"cost": 0,
"createdAt": "2026-05-29T15:00:00+08:00"
}Success (image)
{
"jobId": "task_20260529150000_abc12345",
"comment": "JobStatusSuccess",
"text": "can in,",
"urls": [
"https://fc-gw-sh.oss-accelerate.aliyuncs.com/images/2026/05/29/output_001.png"
],
"cost": 0.6,
"createdAt": "2026-05-29T15:00:00+08:00",
"finishedAt": "2026-05-29T15:01:30+08:00"
}Success (video)
{
"jobId": "task_20260529160000_def67890",
"comment": "JobStatusSuccess",
"videoUrls": [
"https://fc-gw-sh.oss-accelerate.aliyuncs.com/videos/2026/05/29/output.mp4"
],
"cost": 1.2,
"createdAt": "2026-05-29T16:00:00+08:00",
"finishedAt": "2026-05-29T16:03:30+08:00"
}Failure
{
"jobId": "task_20260529150000_abc12345",
"comment": "JobStatusFail",
"reason": "Failure",
"cost": 0,
"createdAt": "2026-05-29T15:00:00+08:00",
"finishedAt": "2026-05-29T15:00:40+08:00"
}taskFailurewhencommentas FailureStatus,reasonfieldafter Failure, the frozen amount is automatically returned.
Task Status
endpoint returncomment fieldand query endpointstatus fielduse Status: | Statuslocalized example text | Description |
|---|---|---|
| JobStatusCreated | create | |
| JobStatusQueued | queued | |
| JobStatusRunning | execute in | |
| JobStatusSuccess | Success | |
| JobStatusFail | Failure (not Error) | |
| JobStatusError | execute | |
| JobStatusReject | imagenot | |
| JobStatusTextReject | not | |
| JobStatusBadPrompt | PromptFormatError | |
| JobStatusInvalidParameter | PromptFormatError, localized example text | |
| JobStatusTimeout | taskFailure (when ) | |
| JobStatusRequestTimeout | taskFailure ( when ) | |
| JobStatusInvalidImagePromptLink | no image | |
| JobStatusMaxConcurrentLimited | when task | |
| JobStatusCreditNotEnough | tasklocalized example text | |
| JobStatusCanceled | Task cancelled | |
| JobStatusImagePromptDenied | image prompt localized example text | |
| JobStatusDuplicateImage | in Image |
Callback Notification
Create Taskwhen providecallback, taskcomplete (Success or Failure) after the system will POST Request, Request Body as task ( and「Query Tasklocalized example text」).
Headers
Content-Type: application/jsonBody localized example text
{
"jobId": "task_20260529150000_abc12345",
"comment": "JobStatusSuccess",
"urls": ["https://fc-gw-sh.oss-accelerate.aliyuncs.com/images/output_001.png"],
"cost": 0.6,
"createdAt": "2026-05-29T15:00:00+08:00",
"finishedAt": "2026-05-29T15:01:30+08:00"
}return HTTP 200 Success.
Error Codes
| code | message | Description |
|---|---|---|
| 400 | Invalid_Argument | Request Parametersno / Task not found |
| 402 | Account_Fee_Not_Enough | Insufficient balance |
| 500 | Internal_Server_Error | Internal server error |
Best Practices
1. taskPolling Strategy
endpoint as task,「Query Tasklocalized example text」 (GET /job/{jobId})Pollinglocalized example text.recommendedPolling:
- First 30 seconds:query every 3 seconds
- 30 seconds~ 2 minutes:query every 5 seconds
- After 2 minutes:query every 10 seconds
localized example textcomment asJobStatusSuccess whenurls / videoUrls; as FailureStatus when Polling.
2. Processing Time Reference
- image /:Usually 30 seconds~ 2 minutes
- Image-to-Video:Usually 1 ~ 5 minutes
- video/ video height:Usually 1~ 3 minutes
3. Balance Management
- Create Taskwhen will (), Insufficient balance will return
402 Account_Fee_Not_Enough. - taskSuccessafter in,
costfieldlocalized example text. - taskFailureafter the frozen amount is automatically returned.