Midjourney Text To Image API Documentation

Midjourney Text To Image API Documentation

Playground

Try it on WaveSpeedAI!

Midjourney Text-to-Image creates high-quality, artistic images from text prompts, with strong creative interpretation, detailed composition, and flexible visual styles for concept art, marketing assets, social content, and production workflows. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.

Features

Midjourney Text-to-Image generates images from a text prompt. Describe the image you want, optionally add a style reference image, choose an aspect ratio, and adjust generation controls such as HD mode, quality, stylize, chaos, weird, and seed.


Why Choose This?

  • Prompt-based image generation
    Generate images directly from a text prompt.

  • Style reference support
    Use an optional style reference image to guide the visual style of the generated images.

  • Flexible aspect ratios
    Choose from multiple output aspect ratios, including square, vertical, horizontal, and cinematic formats.

  • Generation control parameters
    Adjust stylize, chaos, and weird to control aesthetic strength, variation, and unconventional visual characteristics.

  • HD mode
    Enable hd when you want higher-definition generation.

  • Seed support
    Use a fixed seed for more reproducible results, or set -1 for a random seed.


Parameters

ParameterRequiredDescription
promptYesText prompt describing the image to generate. Maximum length: 1024 characters.
srefNoOptional style reference image URL.
aspect_ratioNoAspect ratio of the generated images. Options: 1:1, 9:16, 16:9, 4:3, 3:4, 2:3, 3:2, 9:21, or 21:9. Default: 1:1.
hdNoEnable HD generation mode. Default: false.
qualityNoGeneration quality setting. Options: 1 or 4. Default: 1.
stylizeNoControls how strongly the model’s aesthetic style influences the result. Range: 0–1000. Default: 0.
chaosNoControls variation and unpredictability. Range: 0–100. Default: 0.
weirdNoAdds unconventional or surreal characteristics. Range: 0–3000. Default: 0.
seedNoRandom seed. Use -1 for a random seed. Range: -1–2147483647. Default: -1.

How to Use

  1. Write your prompt — Describe the image you want to generate, including subject, composition, lighting, mood, and style.
  2. Add a style reference optional — Provide sref if you want to guide the visual style with a reference image.
  3. Choose aspect ratio — Select the output format, such as 1:1, 9:16, 16:9, or 21:9.
  4. Configure HD optional — Enable hd when higher-definition generation is needed.
  5. Adjust generation settings optional — Configure quality, stylize, chaos, weird, and seed as needed.
  6. Submit — Generate the image outputs.

Output

Returns generated image URL(s) in the standard WaveSpeed prediction response.

Each request generates 4 images.


Pricing

Pricing is based on whether hd is enabled. Each request generates 4 images.

HD ModeRequest CostEffective Cost per Image
false$0.10$0.025
true$0.15$0.0375

Other parameters do not add separate charges.


Best Use Cases

  • Creative image generation — Generate original images from text prompts.
  • Concept art — Create visual concepts for characters, scenes, objects, and environments.
  • Social media visuals — Generate images for posts, thumbnails, banners, and campaigns.
  • Style exploration — Use sref, stylize, chaos, and weird to test different visual directions.
  • Cinematic and vertical formats — Use aspect ratios such as 16:9, 21:9, 9:16, or 9:21 for different content formats.

Pro Tips

  • Keep prompts clear and specific.
  • Use sref when you want the output to follow a specific visual style.
  • Use stylize to control the strength of the model’s aesthetic influence.
  • Increase chaos when you want more variation across outputs.
  • Increase weird when you want more unconventional or surreal results.
  • Enable hd when higher-definition output is needed.
  • Use a fixed seed when you want more reproducible generations.
  • Use -1 for random seed generation.
  • Choose the aspect ratio based on the final use case, such as 1:1 for square images, 9:16 for vertical content, or 16:9 for widescreen images.

Authentication

For authentication details, please refer to the Authentication Guide.

API Endpoints

Submit Task & Query Result

set -euo pipefail

export WAVESPEED_API_KEY="your-api-key"

REQUEST_BODY=$(cat <<'JSON'
{
  "prompt": "A cinematic ocean wave at sunrise, highly detailed",
  "aspect_ratio": "1:1",
  "hd": false,
  "quality": 1,
  "stylize": 0,
  "chaos": 0,
  "weird": 0,
  "seed": -1
}
JSON
)

# 1. Submit the prediction.
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
  -X POST "https://api.wavespeed.ai/api/v3/midjourney/text-to-image" \
  -H "Authorization: Bearer ${WAVESPEED_API_KEY}" \
  -H "Content-Type: application/json" \
  -d "${REQUEST_BODY}")

TASK=$(printf '%s' "${SUBMIT_RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
PREDICTION_ID=$(printf '%s' "${TASK}" | jq -r '.id // empty')
if [ -z "${PREDICTION_ID}" ]; then
  printf 'Submission response did not contain a prediction id
' >&2
  exit 1
fi
RESULT_URL="https://api.wavespeed.ai/api/v3/predictions/${PREDICTION_ID}/result"

# 2. Poll until the prediction finishes.
while true; do
  RESPONSE=$(curl --silent --show-error --fail-with-body \
    "${RESULT_URL}" \
    -H "Authorization: Bearer ${WAVESPEED_API_KEY}")
  RESULT=$(printf '%s' "${RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
  STATUS=$(printf '%s' "${RESULT}" | jq -r '.status // empty')

  case "${STATUS}" in
    completed) printf '%s\n' "${RESULT}" | jq '.outputs'; break ;;
    failed|cancelled|timeout|deleted) printf '%s\n' "${RESULT}" | jq . >&2; exit 1 ;;
    *) sleep 2 ;;
  esac
done

Parameters

Task Submission Parameters

Request Parameters

ParameterTypeRequiredDefaultRangeDescription
promptstringYes-Text prompt describing the image to generate.
srefstringNo--Optional style reference image URL.
aspect_ratiostringNo1:11:1, 9:16, 16:9, 4:3, 3:4, 2:3, 3:2, 9:21, 21:9Aspect ratio of the generated images.
hdbooleanNofalse-Enable HD generation mode.
qualityintegerNo11, 4Generation quality setting supported by Midjourney v8.1.
stylizeintegerNo00 ~ 1000Controls how strongly Midjourney's aesthetic style influences the result.
chaosintegerNo00 ~ 100Controls variation and unpredictability.
weirdintegerNo00 ~ 3000Adds unconventional or surreal characteristics.
seedintegerNo-1-1 ~ 2147483647Random seed. Use -1 for a random seed.

Response Parameters

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
data.idstringUnique identifier for the prediction, Task Id
data.modelstringModel ID used for the prediction
data.outputsarrayOutput values, usually URL strings; some models return text strings or structured result objects (empty when status is not completed)
data.urlsobjectObject containing related API endpoints
data.statusstringTask status. completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses.
data.created_atstringISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”)
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds

Result Request Parameters

ParameterTypeRequiredDefaultDescription
idstringYes-Task ID

Result Response Parameters

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
dataobjectThe prediction data object containing all details
data.idstringUnique identifier for the prediction
data.modelstringModel ID used for the prediction
data.outputsarray<string | object>Array of generated outputs (empty when status is not completed). Items are usually URL strings, but may be text strings or structured result objects, depending on the model.
data.urlsobjectObject containing related API endpoints
data.statusstringStatus: completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses
data.created_atstringISO timestamp of when the request was created
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds
© 2026 WaveSpeedAI. All rights reserved.