Image
MAI-Image-2.7 Flash
Fast, lower-cost image generation and editing with Microsoft MAI-Image-2.7 Flash using up to 5 reference URLs, 1K/2K or exact pixels, and token-based pricing.
Quick example
Submit one image request, save the returned id, and poll until the task is completed or failed. This API uses asynchronous tasks and PNG URL outputs.
curl https://api.seedrouter.ai/v1/images/generations \
-H "Authorization: Bearer $SEEDROUTER_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"model":"mai-image-2.7-flash","prompt":"A glass perfume bottle on a white marble countertop, clean product photography","size":"1:1","resolution":"1K"}'Endpoint and headers
POST https://api.seedrouter.ai/v1/images/generations
| Header | Value |
|---|---|
| Authorization | Bearer YOUR_API_KEY |
| Content-Type | application/json |
Keep the key on your server. An HTTP 200 acknowledges a task; it does not mean the image is ready. Image editing uses the same /v1/images/generations endpoint with image_urls.
Parameters
mai-image-2.7-flash shares the exact 9 accepted fields and constraints of mai-image-2.7. Only model and prompt are required. Omit optional fields to use defaults; no field accepts null. The Playground exposes the fixed model and all 8 editable inputs.
| Field | Type | Default | Constraint |
|---|---|---|---|
model | string | Required | mai-image-2.7-flash |
prompt | string | Required | 1–20000 Unicode characters after trimming |
n | integer | 1 | Must be 1; submit separate tasks for multiple images |
size | string | 1:1 | Text-to-image only; integer aspect ratio 1:4–4:1 or WIDTHxHEIGHT (* / × also accepted); auto is rejected |
resolution | string | 1K | 1K or 2K (case-insensitive); applies only when size is an aspect ratio; 4K is rejected |
width | integer | Omitted | Exact pixel width, >= 768; must be paired with height; overrides size and resolution; text-to-image only |
height | integer | Omitted | Exact pixel height, >= 768; must be paired with width; width × height <= 4,194,304 (2048×2048) |
image_urls | string array | Omitted | 1–5 public HTTP(S) image URLs without credentials for single-image editing or multi-image composition |
background | string | auto | auto or opaque; transparent is rejected |
Dimensions and aspect ratios
For text-to-image, pass size (an integer ratio from 1:4 to 4:1) with resolution (1K or 2K), pass pixel dimensions in size (such as 2048x1152), or pass width and height together.
- Pixel constraints: each side must be at least
768, andwidth × heightmust not exceed4,194,304(2048×2048). Each side is rounded down to a multiple of 32. widthandheighttake highest priority oversizeandresolution.- Unknown fields return HTTP 400. Output is always PNG.
Reference images
Pass 1–5 publicly accessible HTTP(S) URLs without embedded credentials in image_urls for single-image editing or multi-image composition. Supported inputs are JPEG, PNG, WebP, and GIF. Base64 data URIs are not accepted through SeedRouter.
When image_urls is supplied, the model determines output dimensions from the reference images; size, resolution, width, and height do not affect image-to-image output dimensions.
{
"model": "mai-image-2.7-flash",
"prompt": "Combine both reference images into a clean studio product photograph",
"image_urls": [
"https://example.com/first.png",
"https://example.com/second.png"
]
}Billing
Billing uses three token categories: text input, image input, and image output. Multiply the measured usage in each category by its live rate. Failed requests are not charged. See live pricing.
Task response and polling
An accepted request returns an asynchronous task:
{"id":"task_example","model":"mai-image-2.7-flash","status":"processing"}curl https://api.seedrouter.ai/v1/tasks/task_example \
-H "Authorization: Bearer $SEEDROUTER_API_KEY"A completed response contains the delivered PNG URL in output.data[0].url, its measured size, output.output_format, and output.usage. Poll every 5–10 seconds. Do not submit a duplicate request after a client timeout.
Errors
HTTP errors use {"error":{"code":integer,"message":string}}. See the shared error directory and task lifecycle.
