MuseSpark
MuseSpark
Models & toolsImage models

Mai Image 2.6 API guide

Mai Image 2.6 API: Generate or edit images with Mai Image 2.6, using text and optional image references. The public request includes resolution, aspect ratio, exact dimensions, and web-grounding controls; follow the rules when combining them.

Model overview

Generate or edit images with Mai Image 2.6, using text and optional image references. The public request includes resolution, aspect ratio, exact dimensions, and web-grounding controls; follow the rules when combining them.

API integration

DocumentationValue
API invocation identifiermai-image-2.6
IntegrationAsync task API

Use this invocation identifier in API requests. Check your authorized model catalog for access. Follow the Quickstart for your first complete call.

Request parameters

Select a mode to highlight its required inputs. Mode selection does not change the API field names.

Studio presets describe the form setup, not guaranteed server defaults. Send preset values explicitly to reproduce them.

promptstringNon-nullRequired

Image generation or reference-image editing prompt.

Length: minimum 1.

imagesarray<string>Non-nullConditional

Required for Image Editing and References.

Additional requirements depend on other values. See model rules.

Provide up to 5 publicly accessible HTTP or HTTPS image URLs or complete image data URIs. JPEG and PNG are supported; WebP and GIF are converted automatically. Use one image as an editing reference or multiple images to combine references. Editing dimensions are chosen automatically.

Item count: minimum 1; maximum 5.

Media types: image/*.

resolutionstringNon-nullOptional

Text-to-image resolution: 1K or 2K. Lowercase 1k and 2k are also accepted. Exact pixel dimensions override this setting. This setting does not control editing dimensions.

Allowed values: "1K", "1k", "2K", "2k".

Studio preset: "1K".

aspect_ratiostringNon-nullOptional

Choose one of the listed aspect ratios or auto for text-to-image generation. Editing dimensions are chosen automatically from the reference images.

Allowed values (16)

Allowed values: "auto", "1:1", "3:2", "2:3", "4:3", "3:4", "5:4", "4:5", "16:9", "9:16", "2:1", "1:2", "3:1", "1:3", "21:9", "9:21".

web_groundingbooleanNon-nullOptional

Search current information before generation, for example real people, places, or events.

batch_sizeintegerNon-nullOptional

MuseSpark batch count; each child task requests one provider output.

Repeats MuseSpark execution within one logical task. This is separate from a model-native output count.

Value: minimum 1; maximum 15.

Studio preset: 1.

widthintegerNon-nullConditional

Additional requirements depend on other values. See model rules.

For text-to-image generation, set width and height together. Each must be at least 768 pixels, with no more than 2359296 pixels in total. Multiples of 32 are recommended; other values are rounded down to a multiple of 32. Exact dimensions override aspect ratio and resolution. These settings do not control editing dimensions.

Value: minimum 768; maximum 3072.

heightintegerNon-nullConditional

Additional requirements depend on other values. See model rules.

For text-to-image generation, set width and height together. Each must be at least 768 pixels, with no more than 2359296 pixels in total. Multiples of 32 are recommended; other values are rounded down to a multiple of 32. Exact dimensions override aspect ratio and resolution. These settings do not control editing dimensions.

Value: minimum 768; maximum 3072.

auto_aspect_ratiobooleanNon-nullOptional

Choose the text-to-image aspect ratio automatically from the prompt. This setting does not control editing dimensions.

No parameters match. Clear the search or reset the filters.

Model rules

Input modes

Select a mode by supplying its required public inputs. The mode identifier describes a documentation/form choice; do not send input_mode as a model parameter.

ModeRequired inputs
Text to ImageNo reference media required
Image Editing and Referencesimages
  • When the input mode is Text to Image, omit images.
  • When the input mode is Image Editing and References, provide images; keep images, when supplied, at least 1 items.
  • When width is provided, provide height.
  • When height is provided, provide width.

Parameter meaning

  • Resolution tiers apply to text-to-image ratio sizing. Exact-pixel dimensions and reference-image editing follow their own dimension rules.
  • For image editing, let the input images establish the output dimensions; a text-to-image resolution setting cannot be assumed to resize an edit.

batch_size controls repeated MuseSpark executions. Output grouping, sequential image generation, and video shot count are separate concepts.

Request examples

Replace example media URLs and YOUR_... input identifiers with your own valid resources. Examples are checked against the exported item schema; media access and paid execution are separate runtime checks.

Set MUSESPARK_API_KEY and a stable MUSESPARK_REQUEST_ID before submitting. Preserve the request ID for retries of the same request and use a new ID for new work. Python examples use requests; JavaScript examples use Node.js 20 or later. The standalone Quickstart includes task polling and recovery.

Text to Image

curl --fail-with-body 'https://api.musespark.ai/api/v1/openapi/task' \
  -H "Authorization: Bearer $MUSESPARK_API_KEY" \
  -H "X-Idempotency-Key: $MUSESPARK_REQUEST_ID" \
  -H 'Content-Type: application/json' \
  -d '{
  "item_key": "mai-image-2.6",
  "parameters": {
    "batch_size": 1,
    "resolution": "1K",
    "prompt": "A paper city under soft morning light"
  }
}'

Parameters used: batch_size · resolution · prompt.

Image Editing and References

curl --fail-with-body 'https://api.musespark.ai/api/v1/openapi/task' \
  -H "Authorization: Bearer $MUSESPARK_API_KEY" \
  -H "X-Idempotency-Key: $MUSESPARK_REQUEST_ID" \
  -H 'Content-Type: application/json' \
  -d '{
  "item_key": "mai-image-2.6",
  "parameters": {
    "batch_size": 1,
    "resolution": "1K",
    "prompt": "A paper city under soft morning light",
    "images": [
      "https://example.com/input-1.png"
    ]
  }
}'

Parameters used: batch_size · resolution · prompt · images.

Output

Creation returns a task ID inside data. Poll that task until completion, then save data.result.output_urls and any data.result.batch_results. See the task lifecycle for terminal states, result retention, and errors.

Troubleshooting

For rejected inputs, check the field type, accepted values, and conditional requirements in Request parameters and Model rules. Correct the affected fields before submitting again.

If creation times out, preserve the request identity and any known task ID. Follow Errors, timeouts and retries before submitting again.

The public input snapshot was exported on 2026-11-09. Current prices and availability are listed in the model center.