# MAI Image 2.7 Flash

> MAI Image 2.7 Flash: the fast, low-cost MAI Image 2.7 — pictures up to 2K and photo edits.

MAI Image 2.7 Flash is the fast, low-cost version of Microsoft AI's MAI Image 2.7: the same tools (pictures from a description, edits and merges of up to 5 photos, 1K and 2K) with slightly lower quality and a quicker answer. It understands English prompts best.


One model, `mai-image-2.7-flash`: no photos = generate from scratch; with photos = edit or references.

### Prompt only — the model creates the picture from scratch.

ID: `mai-image-2.7-flash` · 1K $0.012 · 2K $0.043 per image · under 1 min

**Parameters** (field `input`)

| Parameter | Required | Description | Values (default in bold) |
|---|---|---|---|
| `prompt` | yes | What to draw or what to change | text, up to 20000 chars |
| `aspect_ratio` | no | Image shape | **`1:1`** `16:9` `9:16` `4:3` `3:4` `3:2` `2:3` `4:5` `5:4` `21:9` |
| `resolution` | no | Long side: 0.5K ≈ 512 px, 1K ≈ 1024 px, 2K ≈ 2048 px, 4K ≈ 4096 px. Sizes above native are an upscale of the finished picture (Lanczos + light sharpening): 4K on Nano Banana 2.1 and Pro from 2K, 2K on Nano Banana from 1K, 2K and 4K on GPT Image from its native ~1.5K | **`1K`** `2K` |

**Example**

```bash
curl -X POST https://mixmedia.tech/api/v1/jobs/createTask \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"mai-image-2.7-flash","input":{"prompt":"A cat astronaut in a neon city, cinematic light","aspect_ratio":"1:1","resolution":"1K"}}'
```

```python
import os, requests

r = requests.post(
    "https://mixmedia.tech/api/v1/jobs/createTask",
    headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
    json={
      "model": "mai-image-2.7-flash",
      "input": {
        "prompt": "A cat astronaut in a neon city, cinematic light",
        "aspect_ratio": "1:1",
        "resolution": "1K"
      }
    },
)
print(r.json())  # {"code": 200, "data": {"taskId": "..."}}
```

```javascript
const r = await fetch("https://mixmedia.tech/api/v1/jobs/createTask", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "model": "mai-image-2.7-flash",
    "input": {
      "prompt": "A cat astronaut in a neon city, cinematic light",
      "aspect_ratio": "1:1",
      "resolution": "1K"
    }
  }),
});
console.log(await r.json()); // { code: 200, data: { taskId: "..." } }
```

### With photos in `input`: describe what to change.

ID: `mai-image-2.7-flash` · 1K $0.012 · 2K $0.043 per image · under 1 min

**Parameters** (field `input`)

| Parameter | Required | Description | Values (default in bold) |
|---|---|---|---|
| `prompt` | yes | What to draw or what to change | text, up to 20000 chars |
| `image_urls` | yes | Links to your photos (https), up to 5 | `["https://…"]` |
| `aspect_ratio` | no | Image shape | **`1:1`** `16:9` `9:16` `4:3` `3:4` `3:2` `2:3` `4:5` `5:4` `21:9` |
| `resolution` | no | Long side: 0.5K ≈ 512 px, 1K ≈ 1024 px, 2K ≈ 2048 px, 4K ≈ 4096 px. Sizes above native are an upscale of the finished picture (Lanczos + light sharpening): 4K on Nano Banana 2.1 and Pro from 2K, 2K on Nano Banana from 1K, 2K and 4K on GPT Image from its native ~1.5K | **`1K`** `2K` |

**Example**

```bash
curl -X POST https://mixmedia.tech/api/v1/jobs/createTask \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"mai-image-2.7-flash","input":{"prompt":"Make the background a neon city at night","image_urls":["https://mixmedia.tech/static/img/previews/gpt-t2i.jpg"],"aspect_ratio":"1:1","resolution":"1K"}}'
```

```python
import os, requests

r = requests.post(
    "https://mixmedia.tech/api/v1/jobs/createTask",
    headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
    json={
      "model": "mai-image-2.7-flash",
      "input": {
        "prompt": "Make the background a neon city at night",
        "image_urls": [
          "https://mixmedia.tech/static/img/previews/gpt-t2i.jpg"
        ],
        "aspect_ratio": "1:1",
        "resolution": "1K"
      }
    },
)
print(r.json())  # {"code": 200, "data": {"taskId": "..."}}
```

```javascript
const r = await fetch("https://mixmedia.tech/api/v1/jobs/createTask", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "model": "mai-image-2.7-flash",
    "input": {
      "prompt": "Make the background a neon city at night",
      "image_urls": [
        "https://mixmedia.tech/static/img/previews/gpt-t2i.jpg"
      ],
      "aspect_ratio": "1:1",
      "resolution": "1K"
    }
  }),
});
console.log(await r.json()); // { code: 200, data: { taskId: "..." } }
```

## Compatibility

Requests in the OpenAI format and other popular API formats work too:

- `model`: `mai-image-2.7-flash`, `mai-image-2-7-flash`, `microsoft/mai-image-2.7-flash`, `mai-image-flash`.
- `size` instead of `aspect_ratio`: a ratio (`16:9`) or exact pixels (`1600x1200`) — we use the closest supported ratio.
- Photos can go in `image_urls`, `image_input` or `input_urls`. Parameters may also be sent at the top level of the body, without the `input` wrapper.
- `resolution` in any case (`1k`, `2K`); `jpg` and `jpeg` are the same. `n` must be `1` (one image per request).
- `nsfw_check`, `official_fallback`, `google_search` are accepted but do not change the result.

## Result



Same as any task: call [recordInfo](https://docs.mixmedia.tech/en/endpoints/record-info) or receive a [callback](https://docs.mixmedia.tech/en/callbacks). Image links are in `resultJson` (kept for 24 hours — download right away).

Upload your photos via [files/upload](https://docs.mixmedia.tech/en/endpoints/upload) or pass any public https links.

## Error handling

API responses are JSON `{"code", "msg", "data"}`; errors also have a string `error` field (type). **On `/api/v1/*` the HTTP status matches body `code`.**

### Example response bodies

**400**

```json
{
  "code": 400,
  "msg": "input.duration: must be between 4 and 30, or \"auto\" / -1",
  "data": null,
  "error": "invalid_request_error"
}
```

**401**

```json
{
  "code": 401,
  "msg": "Authentication failed. Please check your API key",
  "data": null,
  "error": "authentication_error"
}
```

**402**

```json
{
  "code": 402,
  "msg": "Insufficient balance. Please top up and try again. Available: $0.01, required: $0.015. Top up at https://mixmedia.tech/cabinet/billing",
  "data": {
    "balance": "0.0100",
    "required": "0.0150",
    "currency": "USD",
    "topUpUrl": "https://mixmedia.tech/cabinet/billing"
  },
  "error": "payment_required"
}
```

**429**

```json
{
  "code": 429,
  "msg": "Rate limit exceeded: 10 createTask/upload requests per 10 s per key. Retry after 8s",
  "data": null,
  "error": "rate_limit_error"
}
```

**500**

```json
{
  "code": 500,
  "msg": "Internal server error",
  "data": null,
  "error": "server_error"
}
```

### Codes on createTask / upload

| code | error | Meaning | What to do |
|---|---|---|---|
| 400 | `invalid_request_error` | Invalid parameter or body | See `msg` |
| 400 | `unsupported_model` | Unknown model | [Model list](https://docs.mixmedia.tech/en/models) |
| 401 | `authentication_error` | Missing or invalid key | Check the key |
| 402 | `payment_required` | Not enough balance | Top up |
| 403 | `permission_error` | No access | Contact support |
| 429 | `rate_limit_error` | Too many requests | Wait for `Retry-After` |
| 505 | `model_disabled` | Model temporarily disabled | Pick another |
| 500 | `server_error` | Our failure | Retry later |

Example `msg` values: `Authentication failed. Please check your API key` (401); `Insufficient balance. Please top up and try again…` (402).

### Task errors (recordInfo)

If the task was created and then failed: `state: "fail"` (alias `status: "failed"`), `failCode` / `failMsg`, and `error: { code, message, type }`. Money is refunded (`refunded: true`).

| failCode | error.type | Meaning |
|---|---|---|
| 400 | `nsfw_content_detected` / `invalid_request_error` | Moderation — `failMsg` is upstream text verbatim |
| 422 | `invalid_request_error` | The model rejected the parameters (e.g. a photo could not be downloaded) |
| 501 | `server_error` | The model could not generate (`failMsg`) |
| 504 | `timeout_error` | Timed out — retry |
| 500 / 503 | `server_error` | Service temporarily unavailable |

### Rate limits

| What | Limit |
|---|---|
| createTask and upload | 20 per 10 s per key |
| recordInfo / list / balance | 100 per 10 s per key |

Over the limit — HTTP 429 and `Retry-After`.
