Перейти к основному содержанию

Endpoints

MethodEndpointDescription
POST/api/v1/generateTask/midjourneyСоздание задачи генерации
GET/api/v1/statusTask/midjourneyЗапрос статуса задачи

Authentication

Все запросы требуют API Key в заголовке:
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

request_type
string
по умолчанию:"async"
async (polling) или callback (webhook)
callback_url
string
Callback URL, обязателен при request_type=callback (условно)
provider
string
по умолчанию:"auto"
Стратегия маршрутизации: auto, value или official

Input Parameters

All modes require the input object with mode-specific parameters. Universal Input Parameters:
mode
string
обязательно
Operation mode: text-to-image, image-to-image, vary, or upscale
version
string
по умолчанию:"v6.1"
Model version (see version guide below). Options: ‘v6’, ‘v6.1’, ‘v7’, ‘niji 6’, ‘niji 7’
speed
string
по умолчанию:"fast"
Generation speed: ‘fast’ or ‘turbo’
Optional Enhancement Parameters:
enableTranslation
boolean
по умолчанию:"false"
Auto-translate prompts to English for better results. English prompts typically perform better in Midjourney.
aspect
string
по умолчанию:"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
chaos
integer
по умолчанию:"0"
Variation level (0-100). Low (0-30): consistent results. Medium (30-70): balanced variety. High (70-100): diverse, unexpected results.
stylize
integer
по умолчанию:"100"
Artistic vs realistic balance (0-1000). Low (0-250): realistic, literal. Medium (250-750): balanced. High (750-1000): highly artistic.
weird
integer
по умолчанию:"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.
mode
string
обязательно
Set to ‘text-to-image’
prompt
string
обязательно
Text description, 1-2000 characters
version
string
обязательно
Model version: ‘v6.1’, ‘v7’, ‘niji 6’, or ‘niji 7’
speed
string
обязательно
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”
mode
string
обязательно
Set to ‘image-to-image’
prompt
string
обязательно
Descriptive text of desired result (not editing instructions). Use descriptive language: ‘a dog in a park’ instead of ‘change background to park’
image_urls
string[]
обязательно
Array of reference image URLs. More images = less control over output. Recommended: 1-2 images for better results
version
string
обязательно
Model version: ‘v6.1’, ‘v7’, ‘niji 6’, or ‘niji 7’
speed
string
обязательно
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.
mode
string
обязательно
Set to ‘upload-paint’
prompt
string
обязательно
Text description for the masked region
image_urls
string[]
обязательно
Array with 1 image URL (the source image to edit)
version
string
обязательно
Model version: ‘v6.1’, ‘v7’, ‘niji 6’, or ‘niji 7’
speed
string
обязательно
Generation speed: ‘fast’ or ‘turbo’
mask
object
обязательно
Inpainting region (choose one method: areas or url)
canvas
object
обязательно
Canvas dimensions
imgPos
object
обязательно
Image position and size on canvas

Mode: vary (Create Variations)

Generate similar but varied versions of a previous result.
mode
string
обязательно
Set to ‘vary’
taskId
string
обязательно
Previous task ID
imageIndex
integer
обязательно
Image index from previous result (0-3)
type
integer
обязательно
Variation strength: 0=Subtle variation, 1=Strong variation
prompt
string
Optional text guidance for the variation

Mode: upscale (High-Resolution Upscaling)

Upscale a previous result to higher resolution.
mode
string
обязательно
Set to ‘upscale’
taskId
string
обязательно
Previous task ID
imageIndex
integer
обязательно
Image index from previous result (0-3)
type
integer
обязательно
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

При успехе возвращает taskId для последующих запросов статуса. Success:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
Error:
{
  "code": 400,
  "message": "Insufficient credits",
  "data": null
}

GET /api/v1/statusTask/midjourney

Запрос статуса выполнения задачи и результатов по 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

taskId
string
Уникальный идентификатор задачи.
state
string
Текущее состояние задачи: pending, processing, success или failed.
resultJson
string
JSON-строка с массивом resultUrls. Присутствует только при success. Парсите через JSON.parse().
failCode
string
Код ошибки. Присутствует только при state=failed. См. Error Codes.
failMsg
string
Читаемое сообщение об ошибке. Присутствует только при state=failed.
createTime
integer
Timestamp создания задачи (Unix миллисекунды).
completeTime
integer
Timestamp завершения задачи (Unix миллисекунды).
costTime
integer
Длительность обработки в миллисекундах.

Error Codes

CodeDescription
400Неверные параметры или ошибка запроса
401Недействительный или отсутствующий API Key
429Превышен лимит запросов
Fail CodeDescription
CONTENT_VIOLATIONКонтент нарушает правила безопасности
INVALID_IMAGE_URLНе удаётся получить доступ к URL изображения
INVALID_TASK_IDInvalid previous task ID

Rate Limits

LimitValue
Requests10000 / minute
Concurrent tasks1000
При превышении возвращается ошибка 429. Подождите и повторите.

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.

Result URLs действительны 15 дней. Скачивайте и сохраняйте важные результаты вовремя. При высокой конкуренции используйте режим callback вместо частого polling.