Skip to content
Halaman ini belum tersedia dalam bahasa anda, jadi kandungannya dipaparkan dalam bahasa Inggeris.

Imagine (text-to-image)

Midjourney text-to-image / image-guided generation. The default entry /v1/midjourney/generations and the explicit /imagine entry behave the same

Semua dokumentasi
POST/v1/midjourney/generations
json
{
  "error": {
    "code": 500,
    "message": "Internal server error. Please try again later",
    "type": "server_error"
  }
}
json
{
  "error": {
    "code": 502,
    "message": "Bad gateway. The server is temporarily unavailable",
    "type": "bad_gateway"
  }
}

Default text-to-image / image-guided endpoint, equivalent to imagine. The explicit /v1/midjourney/generations/imagine endpoint behaves the same way.

ItemValue
actionIMAGINE
Billingmidjourney@imagine[-version][-speed]
Requiredprompt
Optionalimage_urls, prompt fields, speed, metadata

Contoh permintaan

curl --request POST \
  --url https://api.apisea.ai/v1/midjourney/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "prompt": "a beautiful sunset over mountains",
    "size": "16:9",
    "version": "6.1",
    "speed": "fast"
  }'

Request body

FieldTypeRequiredNotes
promptstringYesPrompt; native MJ flags allowed (e.g. --ar 16:9 --v 6.1)
nsfw_checkbooleanNoDefaults to false. Run content moderation before submitting a Midjourney task. • true: use omni-moderation-latest to review prompts and input images • false: skip moderation without adding moderation cost or latency
speedstringNorelax (default) / fast / turbo
image_urlsstring[]NoImage URLs or base64 for image-guided generation
metadataobjectNoCustom metadata saved with the task for business-side tracking

Structured fields (optional)

You can set these in the JSON body or in prompt (e.g. --ar 16:9). Body values override prompt.

FieldTypeMJ equivalentNotes
sizestring--are.g. "16:9", "1:1", "9:16"
qualitystring--q"0.25", "0.5", "1", "2"
stylestring--styleStyle presets depend on the version; for Raw mode in v8.2, use raw: true, not style: "raw"
versionstring--vVersion. Main MJ versions append --v <version>; when used with niji: true and "7" / "6", it is normalized as a Niji version
seedint--seedSeed
negative_promptstring--noe.g. "ugly, blurry"
stylizeint--s0–1000
chaosint--c0–100
weirdint--w0–3000
tilebool--tileTile mode
nijibool--nijiNiji switch. Recommended: niji: true + version: "7" / "6"
iwfloat--iw0–3, image weight
cwint--cw0–100
swint--sw0–1000
crefstring--crefCharacter ref URL
srefstring--srefStyle ref URL
drefstring--drefDepth reference image URL
dwfloat--dwDepth weight (0–100)
repeatint--repeat2–40
rawbool--rawRaw mode (v5.1+); in v8.2, set to true, equivalent to --raw
draftbool--draftDraft mode (v7+)
hdbool--hdHD mode (v8.1 / v8.2 only; backend auto-injects --v 8.1 when version is unspecified)
stopint--stopEarly stop (10–100; v5–6.1 / niji 5–6 only)
extrastringany --xxxEscape hatch; appended to prompt verbatim

Note

Raw mode in v8.2: --style raw is not accepted. Use --v 8.2 --raw in the prompt, or "version": "8.2", "raw": true in the body. Remove any --style raw from the prompt and style: "raw" from the body; do not combine them with --raw / raw: true.

Examples

All flags in prompt

json
{
  "prompt": "a beautiful sunset over mountains --ar 16:9 --v 8.2 --raw --s 750"
}

Structured body (recommended)

json
{
  "prompt": "a beautiful sunset over mountains",
  "size": "16:9",
  "version": "8.2",
  "raw": true,
  "stylize": 750
}

Main versions and Niji versions

json
{
  "prompt": "anime girl in a moonlit garden",
  "niji": true,
  "version": "7",
  "size": "9:16"
}

Verified online versions: 8.2, 8.1, 7, 6.1, 5.2, 5.1, niji 7, and niji 6. Use body field version for main MJ versions. For Niji, use niji: true + version: "7" / "6"; the billing version is normalized to niji7 / niji6.

Mixed (body wins)

json
{
  "prompt": "a beautiful sunset --ar 1:1",
  "size": "16:9"
}

Final prompt: a beautiful sunset --ar 16:9 (size in body overrides --ar 1:1 in prompt.)

Image-guided

json
{
  "prompt": "turn this product into a luxury studio photo",
  "image_urls": ["https://example.com/product.png"],
  "size": "1:1",
  "iw": 1.2
}

Fast mode

json
{
  "prompt": "a cute cat",
  "speed": "fast"
}

speed=relax or omitted speed does not add a billing speed suffix. fast / turbo are applied through the corresponding speed routes and match the corresponding billing keys.

Response

json
{
  "code": 200,
  "data": [{
    "status": "submitted",
    "task_id": "task_01JWXXXXXXXXXXXX"
  }]
}

After submission, poll the result via Get task.

Respons

{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KV52C0TEJSYZMCG0NCS4YWKK"
    }
  ]
}

Menemui masalah dalam dokumentasi ini? E-mel support@apisea.ai.