MAI-Image-2.7 Flash
Fast, cost-efficient 1K–2K image generation and multi-image editing with MAI-Image-2.7 Flash over a single asynchronous API.
MAI-Image-2.7 Flash is the high-throughput sibling of MAI-Image-2.7, sharing the same 1K–2K sizing controls and up to 5 reference images with lower per-token rates for rapid iteration. See the model page for current token rates and the interactive playground.
Quick example
curl https://api.reapi.ai/v1/images/generations \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"model":"mai-image-2.7-flash","prompt":"Overhead flat lay of matte sage packaging boxes on warm travertine stone","size":"1:1","resolution":"1K","n":1}'import requests
response = requests.post(
"https://api.reapi.ai/v1/images/generations",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"model": "mai-image-2.7-flash",
"prompt": "Overhead flat lay of matte sage packaging boxes on warm travertine stone",
"size": "1:1",
"resolution": "1K",
"n": 1,
},
timeout=60,
)
response.raise_for_status()
task_id = response.json()["id"]const response = await fetch('https://api.reapi.ai/v1/images/generations', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'mai-image-2.7-flash',
prompt: 'Overhead flat lay of matte sage packaging boxes on warm travertine stone',
size: '1:1',
resolution: '1K',
n: 1,
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { id: taskId } = await response.json();package main
import (
"encoding/json"
"fmt"
"net/http"
"strings"
"time"
)
func main() {
body := strings.NewReader(`{"model":"mai-image-2.7-flash","prompt":"Overhead flat lay of matte sage packaging boxes on warm travertine stone","size":"1:1","resolution":"1K","n":1}`)
req, err := http.NewRequest("POST", "https://api.reapi.ai/v1/images/generations", body)
if err != nil { panic(err) }
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 60 * time.Second}
res, err := client.Do(req)
if err != nil { panic(err) }
defer res.Body.Close()
if res.StatusCode != http.StatusOK { panic(res.Status) }
var task struct { ID string `json:"id"` }
if err := json.NewDecoder(res.Body).Decode(&task); err != nil { panic(err) }
fmt.Println(task.ID)
}Endpoint
POST https://api.reapi.ai/v1/images/generations
Send Authorization: Bearer YOUR_API_KEY and Content-Type: application/json.
An accepted request returns an asynchronous task id and status: "processing". Poll GET https://api.reapi.ai/v1/tasks/TASK_ID with the same key until the task reaches completed or failed.
Each POST creates a separate generation. If a submission times out on the client, check your task list before resubmitting.
Parameters
| Parameter | Type | Default | Documented behavior |
|---|---|---|---|
model | string | — | Required. Set to "mai-image-2.7-flash". |
prompt | string | — | Required. 1–20,000 Unicode characters after trimming. |
n | integer | 1 | Number of images per request. Must be 1. |
size | string | "1:1" | Text-to-image only. Integer aspect ratio between 1:4 and 4:1 (1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 2:1, 1:2, 21:9, 9:21, 4:1, 1:4) or WIDTHxHEIGHT. auto is not supported. |
resolution | string | "1K" | "1K" or "2K" (case-insensitive). Applies only when size is an aspect ratio. 4K is rejected. |
width | integer | — | Optional custom width in pixels (at least 768). Must be paired with height; overrides size and resolution for text-to-image. |
height | integer | — | Optional custom height in pixels (at least 768). Must be paired with width; width × height must be at most 4,194,304. Sides are rounded down to multiples of 32. |
image_urls | string[] | — | Optional array of 1–5 public HTTP(S) reference image URLs without embedded credentials (JPEG, PNG, WebP, or GIF; base64 data URIs are rejected). |
background | string | "auto" | "auto" or "opaque". Transparent backgrounds are not supported. |
Reference image editing
Pass 1–5 public HTTP(S) URLs in image_urls for fast single-image editing or multi-image composition. When image_urls is supplied, the model derives output dimensions from the reference images; size, resolution, width, and height do not control image-to-image output dimensions.
{
"model": "mai-image-2.7-flash",
"prompt": "Replace the stone surface with pale brushed oak while preserving the bottles and shadows",
"image_urls": [
"https://example.com/bottles.png"
]
}Billing
MAI-Image-2.7 Flash is billed across three token categories: text input, image input, and image output. Admission reserves an estimate; completion settles on the measured usage returned for each category. Failed requests are not charged. See live pricing.