/APIXO Docs

Midjourney

Premium AI image generation with text-to-image, image-to-image, upscale, and variation

Endpoints

MethodEndpointDescription
POST/api/v1/generateTask/midjourneyCreate generation task
GET/api/v1/statusTask/midjourneyQuery task status

Authentication

All requests require an API Key in the header:

Authorization: Bearer YOUR_API_KEY

Request Body

{
  "request_type": "async",
  "callback_url": "https://...",
  "provider": "auto",
  "input": {
    "mode": "text-to-image",
    "version": "v7",
    "speed": "fast",
    "prompt": "..."
  }
}

Parameters

Common Parameters

Parameter
Required
Default
Description
request_typestring
async
async (polling) or callback (webhook)
callback_urlstring
Callback URL, required when request_type=callback
providerstring
auto
Routing strategy: auto, value, or official

Input Parameters

All modes require the input object with mode-specific parameters.

Universal Input Parameters:

Parameter
Required
Default
Description
modestring
Operation mode: text-to-image, image-to-image, vary, or upscale
versionstring
v6.1
Model version (see version guide below). Options: 'v6', 'v6.1', 'v7', 'niji 6', 'niji 7'
speedstring
fast
Generation speed: 'fast' or 'turbo'

Optional Enhancement Parameters:

Parameter
Required
Default
Description
enableTranslationboolean
false
Auto-translate prompts to English for better results. English prompts typically perform better in Midjourney.
aspectstring
1:1
Image aspect ratio. Options: 1:1 (square), 4:3 (classic), 2:3 (portrait), 16:9 (widescreen), 9:16 (mobile). Full list: 1:1, 1:2, 2:1, 2:3, 3:2, 3:4, 4:3, 5:6, 6:5, 9:16, 16:9
chaosinteger
0
Variation level (0-100). Low (0-30): consistent results. Medium (30-70): balanced variety. High (70-100): diverse, unexpected results.
stylizeinteger
100
Artistic vs realistic balance (0-1000). Low (0-250): realistic, literal. Medium (250-750): balanced. High (750-1000): highly artistic.
weirdinteger
0
Surreal/unconventional effects (0-3000). Low (10-300): subtle quirks. Medium (300-1000): noticeable unusual elements. High (1000-3000): extreme surrealism.

Model Version Guide

Available Versions: v6, v6.1, v7, niji 6, niji 7 (Default: v6.1)

v7 (Latest, April 2025)

  • Best overall quality with breakthrough improvements in text/image understanding
  • Exceptional accuracy in human anatomy, hand details, and object textures
  • Includes Sketch Mode for rapid iteration and enhanced image reference capabilities
  • Recommended for: Professional work requiring highest quality and detail

v6.1 (Default, July 2024)

  • ~25% faster than v6 with more coherent results
  • Precise details and textures with excellent balance of speed and quality
  • Recommended for: General use and production workflows

v6 (December 2023)

  • Improved prompt accuracy for longer inputs and enhanced coherence
  • Advanced image prompting and remix capabilities
  • Recommended for: Projects requiring specific v6 characteristics

niji 7 (Latest for Anime)

  • Professional anime creation with precise character control and rich stylization
  • Dramatic lighting, flexible style adjustment from photorealistic to highly stylized
  • Superior multi-character consistency and aesthetic quality
  • Recommended for: Anime, manga, and illustration projects

niji 6 (June 2024)

  • Specialized for Eastern/anime aesthetics with improved Japanese text rendering
  • Better anime eye structure and detail rendering
  • Recommended for: Anime-style illustrations with Japanese text

Mode: text-to-image (Text-to-Image Generation)

Generate images from text descriptions.

Parameter
Required
Default
Description
modestring
Set to 'text-to-image'
promptstring
Text description, 1-2000 characters
versionstring
Model version: 'v6.1', 'v7', 'niji 6', or 'niji 7'
speedstring
Generation speed: 'fast' or 'turbo'

Note: text-to-image mode also supports optional enhancement parameters (aspect, chaos, stylize, weird, enableTranslation) listed above.


Mode: image-to-image (Image-to-Image Generation)

Generate new images based on reference images. Use descriptive language in prompts rather than editing instructions.

Best Practice: Describe the desired result, not the editing action.

  • ✅ Good: "a dog lying in a park"
  • ❌ Bad: "change the background to a park"
Parameter
Required
Default
Description
modestring
Set to 'image-to-image'
promptstring
Descriptive text of desired result (not editing instructions). Use descriptive language: 'a dog in a park' instead of 'change background to park'
image_urlsstring[]
Array of reference image URLs. More images = less control over output. Recommended: 1-2 images for better results
versionstring
Model version: 'v6.1', 'v7', 'niji 6', or 'niji 7'
speedstring
Generation speed: 'fast' or 'turbo'

Mode: upload-paint (Inpainting / Region Editing)

Edit specific regions of an image by painting a mask. Requires precise mask definition.

Parameter
Required
Default
Description
modestring
Set to 'upload-paint'
promptstring
Text description for the masked region
image_urlsstring[]
Array with 1 image URL (the source image to edit)
versionstring
Model version: 'v6.1', 'v7', 'niji 6', or 'niji 7'
speedstring
Generation speed: 'fast' or 'turbo'
maskobject
Inpainting region (choose one method: areas or url)
canvasobject
Canvas dimensions
imgPosobject
Image position and size on canvas

Mode: vary (Create Variations)

Generate similar but varied versions of a previous result.

Parameter
Required
Default
Description
modestring
Set to 'vary'
taskIdstring
Previous task ID
imageIndexinteger
Image index from previous result (0-3)
typeinteger
Variation strength: 0=Subtle variation, 1=Strong variation
promptstring
Optional text guidance for the variation

Mode: upscale (High-Resolution Upscaling)

Upscale a previous result to higher resolution.

Parameter
Required
Default
Description
modestring
Set to 'upscale'
taskIdstring
Previous task ID
imageIndexinteger
Image index from previous result (0-3)
typeinteger
Upscale type: 0=Standard HD, 1=Creative HD, 2=2x HD, 3=4x HD

Available Modes

Currently Available:

  • text-to-image — Text-to-image generation
  • image-to-image — Image-to-image generation with reference images
  • upload-paint — Inpaint specific regions (requires mask)
  • vary — Create variations with similar style
  • upscale — High-resolution upscaling

Additional Capabilities (Contact us to enable):

  • Outpaint — Extend image boundaries
  • Retexture — Apply new textures to images
  • Remove Background — Background removal
  • Reroll — Re-execute generation task

Examples

Text-to-Image

curl -X POST "https://api.apixo.ai/api/v1/generateTask/midjourney" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/callback",
    "provider": "value",
    "input": {
      "mode": "text-to-image",
      "prompt": "一个温馨的赛博朋克咖啡馆,霓虹灯光,电影级照明",
      "version": "v7",
      "speed": "fast",
      "aspect": "16:9",
      "enableTranslation": true,
      "stylize": 500,
      "chaos": 20
    }
  }'

Image-to-Image

curl -X POST "https://api.apixo.ai/api/v1/generateTask/midjourney" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "provider": "official",
    "input": {
      "mode": "image-to-image",
      "prompt": "a dog lying in a beautiful park with green grass and trees",
      "image_urls": ["https://example.com/dog-at-home.jpg"],
      "version": "v7",
      "speed": "fast"
    }
  }'

Upload-Paint (Inpainting)

curl -X POST "https://api.apixo.ai/api/v1/generateTask/midjourney" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "provider": "official",
    "input": {
      "mode": "upload-paint",
      "prompt": "add a modern coffee machine in the center",
      "image_urls": ["https://example.com/cafe.jpg"],
      "version": "v7",
      "speed": "fast",
      "mask": {
        "areas": [{
          "width": 512,
          "height": 512,
          "points": [10,10,10,100,100,100,100,10]
        }]
      },
      "canvas": {
        "width": 1024,
        "height": 1024
      },
      "imgPos": {
        "width": 512,
        "height": 512,
        "x": 256,
        "y": 256
      }
    }
  }'

Vary (Create Variation)

curl -X POST "https://api.apixo.ai/api/v1/generateTask/midjourney" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "vary",
      "taskId": "task_previous_midjourney",
      "imageIndex": 0,
      "type": 1,
      "prompt": "add more vibrant colors"
    }
  }'

Upscale

curl -X POST "https://api.apixo.ai/api/v1/generateTask/midjourney" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "upscale",
      "taskId": "task_previous_midjourney",
      "imageIndex": 2,
      "type": 1
    }
  }'

Response

POST /api/v1/generateTask/midjourney

Returns taskId on success for subsequent status queries.

Success:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}

Error:

{
  "code": 400,
  "message": "Insufficient credits",
  "data": null
}

GET /api/v1/statusTask/midjourney

Query task execution status and results via taskId.

curl -X GET "https://api.apixo.ai/api/v1/statusTask/midjourney?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"

Success:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/img1.png\",\"https://r2.apixo.ai/img2.png\",\"https://r2.apixo.ai/img3.png\",\"https://r2.apixo.ai/img4.png\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}

Failed:

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines"
  }
}

Status Response Fields

FieldTypeDescription
taskIdstringUnique task identifier
statestringpending processing success failed
resultJsonstringJSON containing resultUrls array (on success), typically 4 images
failCodestringError code (on failure)
failMsgstringError message (on failure)
createTimeintegerTask creation timestamp (ms)
completeTimeintegerTask completion timestamp (ms)
costTimeintegerProcessing duration (ms)

Error Codes

CodeDescription
400Invalid parameters or request error
401Invalid or missing API Key
429Rate limit exceeded
Fail CodeDescription
CONTENT_VIOLATIONContent violates safety guidelines
INVALID_IMAGE_URLCannot access provided image URL
INVALID_TASK_IDInvalid previous task ID

Rate Limits

LimitValue
Requests10000 / minute
Concurrent tasks1000

Exceeding limits returns 429 error. Wait and retry.


Tips

  • Prompt translation: Enable enableTranslation: true for non-English prompts. English typically yields better results in Midjourney.

  • Aspect ratio: Choose based on use case:

    • 1:1 - Social media posts, avatars
    • 4:3 - Classic photography, presentations
    • 16:9 - Widescreen, videos, banners
    • 9:16 - Mobile stories, vertical videos
  • Chaos parameter: Control result diversity:

    • 0-30 - Consistent, predictable results (recommended for production)
    • 30-70 - Balanced variety with creative exploration
    • 70-100 - Maximum diversity, experimental outputs
  • Stylize parameter: Balance realism vs artistry:

    • 0-250 - Literal interpretation, realistic
    • 250-750 - Balanced (default: 100)
    • 750-1000 - Highly artistic, creative interpretation
  • Weird parameter: Add surreal/unconventional elements:

    • 10-300 - Subtle unusual touches
    • 300-1000 - Noticeable non-traditional elements
    • 1000-3000 - Extreme surrealism and abstraction
  • Generation time:

    • fast mode: ~30-45 seconds, generates 4 images
    • turbo mode: ~15-25 seconds, faster
    • Submit task, wait 20 seconds, then poll every 3 seconds
  • Callback mode: Use callback mode to avoid frequent polling.

  • Image expiration: Result URLs are valid for 15 days. Download promptly.

  • Content moderation: Prompts must comply with safety guidelines.

  • Version selection: See the Model Version Guide above for detailed recommendations on choosing the right version for your use case

  • Recommended workflow:

    1. Use text-to-image to generate initial 4 images
    2. Select preferred image (0-3), use upscale for high-resolution output
    3. Or use vary to create more variations
    4. Iterate until desired result
  • Image-to-image mode:

    • Use descriptive language in prompts: describe what you want to see, not editing actions
    • Example: "a dog in a park" instead of "change background to park"
    • More reference images = less control over output. Use 1-2 images for best results
  • Upload-paint mode (inpainting):

    • mask.areas: Define polygon regions with width, height, and points array. Points are in clockwise order as [x1,y1,x2,y2,...] from top-left origin
    • mask.url: Black/white mask image with same dimensions as original (white = regenerate region). Supports base64 encoding
    • imgPos: Specifies image position and size on canvas
  • Upscale types:

    • Type 0: Standard HD
    • Type 1: Creative HD (adds creative details)
    • Type 2: 2x HD resolution
    • Type 3: 4x HD resolution
  • Image formats: image_urls supports JPG, PNG, WebP, max 10MB per image.


On this page