Microsoft's MAI-Image-2.5 is a high-quality image generation model available via Azure AI Foundry. It produces photorealistic and artistic images from text prompts with support for various aspect ratios.
Modalities
Price
$5/M tokens
Context
4K
Weekly Tokens
76K
Released
Jun 2, 2026
Sample code and API for MAI-Image-2.5
OpenRouter normalizes requests and responses across providers for you.
1
Get your API key
Create an API key from your OpenRouter dashboard and set it as an environment variable:
2
Make your first request
Use microsoft/mai-image-2.5 with the OpenRouter API:
OpenRouter supports image generation models that can output both text and images. These models can create images from text prompts when you specify modalities: ["image", "text"] in your request. The generated images are returned as base64-encoded data URLs in the assistant message. Learn more about image generation.
In the examples below, the OpenRouter-specific headers are optional. Setting them allows your app to appear on the OpenRouter leaderboards.
Using third-party SDKs
For information about using third-party SDKs and frameworks with OpenRouter, please see our frameworks documentation.
3
Enable streaming
Add "stream": true to your request body to receive responses as server-sent events:
Endpoint
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
POSThttps://openrouter.ai/api/v1/chat/completions
AuthorizationBearer $OPENROUTER_API_KEY
Content-Typeapplication/json
HTTP-Refereroptional — your site URL, for rankings
X-Titleoptional — your site name, for rankings
Modelmicrosoft/mai-image-2.5
Creates a streaming or non-streaming response using the OpenAI Responses API format.