Microsoft
MAI Image 2.7
mai-image-2.7/edit
The precision-focused tier in Microsoft's MAI image series, supporting text-to-image and image-to-image editing, capable of object removal and replacement, inpainting, and enhancement, accepting up to 5 reference images per request for multi-image fusion, and maintaining stable composition across multiple editing rounds
Try mai-image-2.7/edit
Input
Showcases
View all showcasesOutput
imagePricing
mai-image-2.7/edit per image
| Specifications | Unit Price |
|---|---|
| 1K | $0.0621 |
| 2K | $0.2481 |
Positioning overview
This is an image-to-image model for image editing: it accepts one or more reference images plus a text prompt and outputs a static image that has been partially modified, replaced, or enhanced. It supports object removal, attribute adjustments, local repainting, and multi-reference fusion while preserving the overall composition and layout, and it lets you specify the aspect ratio, output resolution, and image format. It suits designers and e-commerce and advertising asset production teams who delegate retouching, compositing, and style-adjustment tasks to the model, then confirm the details manually.
Key highlights
- Local edits keep the composition stable — object removal, replacement, and attribute modification are supported, and the original layout and spatial positions are preserved as far as possible during editing, reducing rework caused by recomposition.
- Fuse up to five reference images in a single pass — a single request can take up to 5 images, used to combine people, products, styles, or scenes, with the prompt describing how they should be fused and the intended result.
- Controllable output specifications — choose 1K or 2K resolution, seven aspect ratios, and PNG, JPEG, or WebP format, with an opaque or transparent background, making it easy to fit into different asset workflows.
- Suited to multi-round refinement edits — maintains strong visual consistency across successive editing rounds, making it suitable for gradually adjusting image details, text, and local effects.
Capabilities
- Reference-image-driven local editing: input at least 1 and at most 5 reference images plus a prompt to remove, replace, modify the attributes of, or locally repaint a specified region, outputting a static image whose overall composition stays stable.
- Multi-reference fusion: a single request can carry up to 5 reference images to combine people, products, styles, or scenes into one image, with the prompt describing the role of each reference image and the intended result.
- Resolution and aspect ratio selection: output resolution can be 1K or 2K; seven aspect ratios are offered in landscape and portrait versions of square, 4:3, 3:2, and 16:9, so you get an image at the size matching your target layout.
- Output format and background control: output format can be PNG, JPEG, or WebP, and the background can be opaque or transparent, convenient for direct use on web pages, in print, or in design assets that need a transparent base layer.
- Multi-round iterative editing: maintains image consistency across successive edits, letting you progressively adjust objects, text, and local effects around the same reference image, which suits incremental revisions of a design draft.
Applicable scenarios
- Local optimization of e-commerce product images — operations staff upload a product image and a simple scene reference image, use a prompt to replace the background or remove clutter, and output a 1K or 2K image that can go directly into product detail pages and ad slots.
- Multi-image compositing of advertising assets — a design team inputs a product image, a person image, and a style reference image, has the model fuse the elements into a single key visual, and outputs static assets for posters, banners, and social media.
- Multi-round fine-tuning of design drafts — a designer uses the first draft as a reference image and submits prompts repeatedly to adjust local colors, text, or object positions, outputting images that progressively approach the target effect for review and finalization.
- Repair and enhancement of old assets — content creators upload old images that lack sharpness or need relighting or restyling, describe the desired effect in a prompt, and obtain enhanced images for republishing or redesign.
Limitations and selection advice
Output resolution is capped at 2K, with no 4K option; if you need a 4K final asset, use another model that supports 4K output. A single editing request can carry at most 5 reference images, so more sources cannot be fused in one request. Prompts are limited to 20,000 characters, and input images must use HTTPS links. Output is a static image; no video or audio is generated. Although multi-round editing maintains strong consistency, it does not guarantee fully identical characters or exact reproduction of the image, so details still need human verification before delivery.
What's new
View changelog →- New model New model now available: mai-image-2.7/flash/edit
- New model New model launched: mai-image-2.7/flash/text-to-image
- New model New model released: mai-image-2.7/edit
Frequently asked questions
View all FAQs →-
What editing operations can this model perform?
It supports object removal, object replacement, attribute modification, local inpainting, and image enhancement, while keeping the composition and layout stable across multiple consecutive edits. When making these edits, write what to change and what to keep into the prompt, and leave the rest for the model to infer from the visual context.
-
What is the maximum number of reference images I can pass in a single request?
Up to 5 images, at least 1, passed in via the image_urls array. For multi-reference fusion, pass the person, product, style, and scene each as separate reference images, and state in the prompt what role each image plays; the model will fuse them according to the visual context.
-
What is the maximum output resolution?
Maximum 2K; no 4K option is offered. resolution accepts 1K or 2K, defaulting to 1K; if 4K output is required, you need to switch to another model that supports 4K.
-
How can I write prompts for better editing results?
Organize the prompt in this order: first anchor what to keep, then write the changes, and finally write the blending requirements: ① Clearly state the composition, subject, lighting, and layout to preserve; ② Specify the exact objects to remove, replace, or modify and their target state; ③ Explain how the new elements should blend with the scene in terms of lighting, scale, and position. This model reasons from visual context when a prompt is ambiguous, so spelling out the constraints in full is more effective than piling on adjectives.
Create a generation task
https://api.hiapi.ai/v1/tasks Headers
AuthorizationstringRequiredAccount API key. Required on every request. Example: Bearer YOUR_HIAPI_API_KEY. Get your API key
Content-TypestringOptionalThe request body is always parsed as JSON; when sent, only application/json (optionally with charset) is accepted — any other value returns 415. Example: application/json.
Idempotency-KeystringOptionalIdempotency key, up to 255 bytes. Retries with the same key from the same account create the task only once; replays return the original taskId.
On network timeouts or client retries, the same key creates the task only once — no double charges (scope: the API key's account). Use a business-unique identifier as the key (e.g. "order-42"); replays return the original taskId, and keys expire 24 hours after the first request. See the Unified Async API overview for the full scenario matrix.
Body
modelstringRequiredCurrent fixed value: mai-image-2.7/edit
routestringOptionalCurrent fixed value: default
inputobjectRequired
Business parameters for mai-image-2.7/edit and route default — see the parameter table below.
promptstringRequiredminLength 1maxLength 20000Text prompt for editing the image, used to describe the desired modifications to the input image; takes a string.
backgroundstringOptionalDefault: "opaque"Controls the background handling of the output image; takes a string, default opaque.
opaquetransparentimage_sizestringOptionalDefault: "square_hd"Controls the size specification of the output image; takes a string, default square_hd.
square_hdportrait_4_3landscape_4_3portrait_3_2landscape_3_2portrait_16_9landscape_16_9image_urlsarrayRequiredminItems 1maxItems 5Array of image URLs to be edited, each element being the address of one input image.
Array [ string ]
resolutionstringOptionalDefault: "1K"Controls the resolution tier of the output image; takes a string, default 1K.
1K2Koutput_formatstringOptionalDefault: "png"Controls the encoding format of the output image; takes a string, default png.
pngjpegwebpcallbackobjectOptional
Terminal-state notification config. When omitted, no callback is delivered — poll the task yourself. See the callback note below.
Provide callback.url when creating a task and HiAPI POSTs to your service once the task reaches a terminal state — no polling needed. The callback payload mirrors the task detail structure; signature verification, delivery retries and idempotency are documented on the Unified Async API overview page.
urlstringRequiredRequired when callback is present. A POST is sent to this URL once the task reaches a terminal state; must be a valid http(s) URL.
whenstringOptionalDefault: "final"Only final is supported today — notified on both success and fail.
finalstoragestringOptionalDefault: "temp"Artifact storage tier: temp (default, retained about 7 days) or persistent (long-term, billed by size). Insufficient balance or exceeding the storage cap silently downgrades to temp; the effective tier is shown in the task detail response.
temppersistentRequest examples
# Submit an async task; returns a taskId immediately (no waiting for generation)
curl -X POST "https://api.hiapi.ai/v1/tasks" \
-H "Authorization: Bearer $HIAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mai-image-2.7/edit",
"input": {
"prompt": "…",
"background": "opaque",
"image_size": "square_hd",
"image_urls": "…",
"resolution": "1K",
"output_format": "png"
}
}' const res = await fetch("https://api.hiapi.ai/v1/tasks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HIAPI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "mai-image-2.7/edit",
input: {
"prompt": "…",
"background": "opaque",
"image_size": "square_hd",
"image_urls": "…",
"resolution": "1K",
"output_format": "png"
}
}),
});
const task = await res.json();
// { code: 200, message: "success", data: { taskId } } import os, requests
res = requests.post(
"https://api.hiapi.ai/v1/tasks",
headers={"Authorization": f"Bearer {os.environ['HIAPI_API_KEY']}"},
json={
"model": "mai-image-2.7/edit",
"input": {
"prompt": "…",
"background": "opaque",
"image_size": "square_hd",
"image_urls": "…",
"resolution": "1K",
"output_format": "png"
}
},
)
print(res.json()) # { code, message, data: { taskId } } 200 OK
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR"
}
} 400 Bad Request
{
"code": 400,
"message": "invalid request",
"data": null,
"error_code": "INVALID_REQUEST"
} Get task detail
https://api.hiapi.ai/v1/tasks/:id Response fields
taskIdstringRequiredTask ID, always prefixed with tk-hiapi-.
modelstringRequiredResolved full model name. Tasks submitted with the route parameter return base@route (e.g. gpt-image-2/text-to-image@ext); otherwise identical to the name passed at creation.
routestringOptionalPresent only when the task was submitted with an explicit route parameter; echoes the submitted value.
statusstringRequiredTask status.
queued Queued, not started yet.
handling Being processed.
archiving Processing finished, artifacts being prepared.
success Terminal: completed, artifacts available (output returned).
fail Terminal: failed (error returned).
After submission, check status: success and fail are terminal, everything else is non-terminal. Poll every 1–3 seconds until terminal. On success, download artifacts from output[].url and transfer them before expireAt; pass storage: "persistent" at creation time when long-term retention is needed.
creatednumberRequiredTask creation time (Unix seconds).
completednumberRequiredUnix seconds when the task reached a terminal state; fixed to 0 while not terminal.
outputarrayOptional
Present only when status == success. Artifact list — always an array; a single task may return multiple types at once (e.g. video + first_frame).
Array [ object ]
Array items
urlstringRequiredArtifact URL, directly downloadable.
typestringRequiredCurrent possible values: video, image, audio, first_frame, last_frame, thumbnail; more may be added later.
expireAtnumberRequiredUnix seconds until which the artifact remains accessible; download or transfer before it expires.
errorobjectOptional
Present only when status == fail.
codestringRequiredBusiness error code.
messagestringRequiredError description.
Response examples
Success
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR",
"model": "happyhorse-1-0",
"status": "success",
"created": 1777282033,
"completed": 1777282099,
"output": [
{
"url": "https://cdn.hiapi.ai/tasks/.../video.mp4",
"type": "video",
"expireAt": 1777886899
}
]
}
} Processing (non-terminal)
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "archiving",
"created": 1777282033,
"completed": 0
}
} Failed
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "fail",
"created": 1777282033,
"completed": 1777282099,
"error": {
"code": "TASK_FAILED",
"message": "task failed"
}
}
} Articles
View all articles →-
Guide
MAI Image 2.7 Image Editing Getting Started Guide: Capabilities, Pricing, and Integration Key Points of the Image Editing Model
From capability boundaries to cost estimation, what developers need to know before integrating the Microsoft image editing model
-
Tutorial
MAI Image 2.7 Image Editing in Practice: 5 High-Value Image Editing Scenarios and Integration Essentials
An image-to-image scenario breakdown for developers: from model selection and integration to cost control
-
Comparison
MAI Image 2.7 Image Editing Side-by-Side Comparison: How to Choose Image Editing Models and Key Migration Points
A developer's framework for image editing model selection based on capability boundaries, per-image cost, and integration approach
Related Models
View all models →Same Type
-
Seedream 5.5 ByteDance $0.019 /image -
Kling Image 4.0 Kuaishou $0.081 /image -
Grok Imagine Image 2.0 xAI $0.052 /image -
Recraft Crisp Upscale Recraft $0.004 /image -
Nano Banana Google $0.011 /image -
FIBO 2.0 Bria $0.057 /image -
FLUX.1 Schnell Black Forest Labs $0.005 /image -
FIBO 1.5 Bria $0.058 /image -
FASHN Tryon v1.6 FASHN $0.107 /image -
Qwen Image 3.0 Alibaba $0.036 /image -
Seedream 5.0 ByteDance $0.025 /image -
GPT Image 2.5 OpenAI $0.0021 /image



