← All models

Microsoft: MAI-Image 2.7

microsoft/mai-image-2.7
MAI-Image-2.7 is an image generation and editing model from Microsoft AI, the precision tier of the MAI-Image-2.7 family alongside the faster MAI-Image-2.7 Flash. It is suited for design-ready visuals and controlled, iterative editing, including multi-reference edits that combine people, products, styles, and scenes from up to five input images while preserving composition and detail. Aspect ratio can be fixed or left to the model to choose for the composition.
Modalities
Price in / out
Price
≈ 5,65 ₽ per image
Context
4.1K
Released
Nov 17, 2026

Parameters

promptrequired, up to 20,000 characters
aspect_ratio1:12:33:23:44:39:1616:9auto
imageimage-to-image (via /v1/images/edits)

How to use via API

import base64
from openai import OpenAI

client = OpenAI(base_url="https://api.mixen.ai/v1", api_key="mxn-...")
img = client.images.generate(
    model="microsoft/mai-image-2.7",
    prompt="Милый кот-космонавт на Марсе",
    # размер задаёт aspect_ratio (у модели нет size-ручки): extra_body={"aspect_ratio": "1:1"}
    n=1,
)
with open("image.png", "wb") as f:
    f.write(base64.b64decode(img.data[0].b64_json))

# image-to-image: передать референс(ы) через multipart
edited = client.images.edit(
    model="microsoft/mai-image-2.7",
    image=open("photo.png", "rb"),  # один или несколько референсов
    prompt="Добавь неоновую вывеску на фасад, сохрани композицию",
)
with open("edited.png", "wb") as f:
    f.write(base64.b64decode(edited.data[0].b64_json))
API docsTry in the bot