AIAPIAIAPI API

MAI Image 2.6 Flash

Model ID microsoft/mai-image-2.6-flash/text-to-image

Overview

Photorealistic image generation with optional web search.

Microsoft · text-to-image

Endpoint

POST /v1/images/generations/async

Authentication

Authorization: Bearer <AIAPIAIAPI_API_KEY>

Request Body

ParameterTypeRequiredNullableDefaultConstraintsDescription
modelstringYesNo-values: microsoft/mai-image-2.6-flash/text-to-imageModel ID used to route the request.
promptstringYesNo--Text prompt describing the requested image.
sizestringNoNo`default`-default, auto, or WIDTHxHEIGHT. Edges must be 768–2346 pixels, with at most 2359296 total pixels.
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.

size

Type: string · Required: No · Nullable: No

default, auto, or WIDTHxHEIGHT. Edges must be 768–2346 pixels, with at most 2359296 total pixels.

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-flash/text-to-image",
      "prompt": "A cinematic camera movement through a forest"
    }'

JSON

{
  "model": "microsoft/mai-image-2.6-flash/text-to-image",
  "prompt": "A cinematic camera movement through a forest"
}

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.