AIAPIAIAPI API

MAI Image 2.6 Edit

Model ID microsoft/mai-image-2.6/edit

Overview

Instruction-driven image editing with up to five reference images.

Microsoft · image-to-image

Endpoint

POST /v1/images/generations/async

Authentication

Authorization: Bearer <AIAPIAIAPI_API_KEY>

Request Body

ParameterTypeRequiredNullableDefaultConstraintsDescription
modelstringYesNo-values: microsoft/mai-image-2.6/editModel ID used to route the request.
promptstringYesNo--Text prompt describing the requested image.
imagesarrayYesNo-min_items: 1; max_count: 5; accepts: URL, Base64 data1–5 JPEG or PNG reference images, each less than 1376256 pixels.
sizestringNoNo`default`values: default, autodefault preserves the input aspect ratio; auto selects an aspect ratio based on the prompt and references.
enable_web_searchbooleanNoNo`false`-Use web search to ground generation with real-time information.

model

Type: string · Required: Yes · Nullable: No

Model ID used to route the request.

prompt

Type: string · Required: Yes · Nullable: No

Text prompt describing the requested image.

images

Type: array · Required: Yes · Nullable: No

1–5 JPEG or PNG reference images, each less than 1376256 pixels.

size

Type: string · Required: No · Nullable: No

default preserves the input aspect ratio; auto selects an aspect ratio based on the prompt and references.

Type: boolean · Required: No · Nullable: No

Use web search to ground generation with real-time information.

Request Example

curl --request POST \
  --url https://aiapiaiapi.com/v1/images/generations/async \
  --header 'Authorization: Bearer $AIAPIAIAPI_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
      "model": "microsoft/mai-image-2.6/edit",
      "prompt": "A cinematic camera movement through a forest",
      "images": ["https://example.com/reference.jpg"]
    }'

JSON

{
  "model": "microsoft/mai-image-2.6/edit",
  "prompt": "A cinematic camera movement through a forest",
  "images": ["https://example.com/reference.jpg"]
}

Response

{
  "code": "success",
  "message": "",
  "data": { "task_id": "image_01K2ABC123" }
}

Task Status

Use the task_id from the create response:

GET /v1/images/generations/async/{task_id}

{
  "code": "success",
  "message": "",
  "data": {
    "task_id": "image_01K2ABC123",
    "status": "SUCCESS",
    "progress": "100%",
    "outputs": ["https://cdn.example.com/images/image_01K2ABC123.png"],
    "start_time": 1786960805,
    "finish_time": 1786960900,
    "submit_time": 1786960800,
    "fail_reason": ""
  }
}

Error Responses

Validation errors return HTTP 400 with a stable error code.

{
  "code": "unsupported_parameter",
  "message": "The parameter is not supported by this model.",
  "data": null
}

Documentation Index

Fetch the complete documentation index at:

https://aiapiaiapi.com/llms.txt

Use this file to discover all available API documentation.