> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omniakey.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 图片生成

> 通过异步媒体 API 用 GPT Image 与 Nano Banana 系列模型生成和编辑图片。

图片任务使用统一的 [媒体任务](https://docs.omniakey.com/zh/media/overview.md) 生命周期：创建、轮询、下载。
本页是当前公开可用模型的完整教程。

## 可用模型

| 模型 | 支持的 action | 说明 |
| - | - | - |
| `gpt-image-2` | `generate`, `edit` | 返回你请求的精确尺寸 |
| `gpt-image-2.5-flare` | `generate`、`edit` | 更新的 2.5 代日常路由，质量仅支持 `low`、`medium`、`high` |
| `gpt-image-2.5-sunburst` | `generate`、`edit` | 同一代 2.5、同价，面向编辑精度 |
| `gpt-image-2.6-flare` | `generate`、`edit` | 最新的 2.6 代日常路由，质量仅支持 `low`、`medium`、`high` |
| `gpt-image-2.6-sunburst` | `generate`、`edit` | 同一代 2.6、与 Flare 同价，面向编辑精度 |

Midjourney 按任务而不是按尺寸计费：每次任务 US\$0.13，返回一张 2048x2048 四宫格。
\| `gemini-3.1-flash-image` | `generate`, `edit` | 速度最快 |
\| `gemini-nano-banana-2.1` | `generate`, `edit` | 1K \$0.019 · 2K \$0.029 · 4K \$0.039 (每次) |
\| `gemini-3.1-flash-image-preview` | `generate`, `edit` | 与 `gemini-3.1-flash-image` 同一模型，同价 |
\| `gemini-3.1-flash-lite-image` | `generate`, `edit` | 1K · \$0.019 (每次) |
\| `gemini-2.5-flash-image` | `generate`, `edit` | 原始 Nano Banana 型号 |
\| `gemini-3-pro-image` | `generate`, `edit` | 文字与排版表现最好 |
\| `gemini-3-pro-image-preview` | `generate`, `edit` | 与 `gemini-3-pro-image` 同一模型，同价 |
\| `qwen-image-3` | `generate`, `edit` | 阿里巴巴。中英文文字渲染出色 |
\| `qwen-image-3-pro` | `generate`, `edit` | 阿里巴巴。小字与密集版面表现最好 |
\| `wan2.7-image-pro` | `generate`, `edit` | 阿里巴巴。最高 4K，支持品牌色控制 |
\| `Dola-Seedream-5.0-pro` | `generate`, `edit` | 字节跳动。对版面与元素精确控制 |
\| `Dola-Seedream-5.0-lite` | `generate`, `edit` | 字节跳动。单次调用成本更低 |
\| `grok-imagine-image` | `generate` | xAI。原版 Grok 图像模型 |
\| `grok-imagine-image-quality` | `generate` | xAI。相同价格下画质更高 |
\| `grok-imagine-image-2.0` | `generate` | xAI。最新的 Grok 图像模型 |
\| `midjourney` | `generate` | Midjourney。一次任务返回一张 2048x2048 四宫格，按任务计费 |

各条 GPT Image 路由都接受文本提示词，默认输出 PNG，也都接受输入图片，从而变成改图任务。
Gemini 系列模型见下方单独章节。

## 生成图片

### 1. 创建任务

```bash theme={null}
curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: paper-boat-001" \
  -d '{
    "model": "gpt-image-2.5-flare",
    "type": "image",
    "operation": "generate",
    "input": {"prompt": "a paper boat on a quiet lake at sunset"},
    "parameters": {"size": "1536x1024", "quality": "high"}
  }'
```

返回 `202 Accepted` 和任务 `id`，把它记下来。

### 2. 轮询直到结束

```bash theme={null}
curl --fail-with-body https://api.omniakey.com/v1/media/tasks/task_9hn6zikVvvz9EFWEH1vaHswGf9tqisGn \
  -H "Authorization: Bearer your-omniakey-api-key"
```

生成通常需要 25–60 秒。完成后的响应类似：

```json theme={null}
{
  "id": "task_9hn6zikVvvz9EFWEH1vaHswGf9tqisGn",
  "status": "succeeded",
  "progress": {"percent": 100, "stage": "completed"},
  "provider": {"status": "succeeded"},
  "usage": {"total_tokens": 1657},
  "assets": [
    {
      "asset_id": "task_9hn6zikVvvz9EFWEH1vaHswGf9tqisGn_asset_0",
      "kind": "image",
      "mime_type": "image/png",
      "byte_size": 1491634,
      "sha256": "34c88dd8f07f10d978b1b8b4eb072519b41d202d779523bd8bd122533600eb2a",
      "expires_at": "2026-09-10T10:44:34Z",
      "url": "https://…signed-url…"
    }
  ]
}
```

### 3. 下载产物

```bash theme={null}
curl -sS -o out.png "$(jq -r '.assets[0].url' result.json)"
```

签名 `url` 大约 1 小时后过期。过期后重新查询任务即可拿到新的 URL —— 图片本身会保留 24 小时。

### Python 示例

```python theme={null}
import time
import requests

API = "https://api.omniakey.com"
HEADERS = {
    "Authorization": "Bearer your-omniakey-api-key",
    "Content-Type": "application/json",
}

task = requests.post(
    f"{API}/v1/media/tasks",
    headers={**HEADERS, "Idempotency-Key": "paper-boat-001"},
    json={
        "model": "gpt-image-2.5-flare",
        "type": "image",
        "operation": "generate",
        "input": {"prompt": "a paper boat on a quiet lake at sunset"},
        "parameters": {"size": "1536x1024", "quality": "high"},
    },
).json()

while task["status"] in ("queued", "processing"):
    time.sleep(3)
    task = requests.get(f"{API}/v1/media/tasks/{task['id']}", headers=HEADERS).json()

if task["status"] != "succeeded":
    raise SystemExit(task.get("error"))

image = requests.get(task["assets"][0]["url"]).content
open("out.png", "wb").write(image)
```

## 参数

| 字段 | 必填 | 取值 |
| - | - | - |
| `input.prompt` | 是 | 图片的文字描述 |
| `parameters.size` | 否 | `1024x1024`、`1536x1024`、`1024x1536` |
| `parameters.quality` | 否 | `low`、`medium`、`high`、`auto` |
| `parameters.n` | 否 | 必须为 `1` |

目前 GPT Image 始终返回不透明的 PNG：`background`、`output_format`、`output_compression` 和 `moderation` 会被转发，但不起作用。

> [!WARNING]
>
> 请传明确的 `WIDTHxHEIGHT`：在当前中转上，`1024x1024` 原样返回 1024×1024，`1536x1024` 原样返回 1536×1024。`1K`、`2K`、`4K` 三个档位会被**上游拒绝**，省略 `size` 也不会归一化到固定画布。请始终以实际下载到的图片尺寸为准，不要假设。

## 编辑图片

三条 GPT Image 路由都接受输入图片，任务会变成改图。输入图片可以是内联 Base64（data URL，或带
`data` 与 `mime_type` 的对象），也可以是放在 `input.media` 里的公开 `https` 链接。多张图片、链接和大图的用法见下文
**多张图片与大图** 一节。

```bash theme={null}
BASE64=$(base64 -i source.png | tr -d '\n')

curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: paper-boat-edit-001" \
  -d '{
    "model": "gpt-image-2.5-flare",
    "type": "image",
    "operation": "edit",
    "input": {
      "prompt": "replace the background with a clean studio wall",
      "image": {"data": "'"$BASE64"'", "mime_type": "image/png"}
    },
    "parameters": {"size": "1024x1024"}
  }'
```

需要多张参考图时，用 `"images": [...]` 代替 `"image"`。改图任务的轮询与下载方式和生成任务
完全一致。

## GPT-Image 2.5 与 2.6 变体

GPT Image 2.5 与 2.6 的 Flare、Sunburst 使用相同的三档分辨率价格。通过 `parameters.size` 传入已公布的像素尺寸，后台据此判断计费档位，`quality` 不影响价格。启用分辨率计费后，省略尺寸或填写 `auto` 都会明确发送 `1024x1024`；`1K`、`2K`、`4K` 会转换为下表方图预设。未定义档位的自定义尺寸会在扣费前拒绝。

| `parameters.size` | Pixels | Tier |
| - | - | - |
| `auto` / `1K` | 1024×1024 | 1K |
| `2K` | 2048×2048 | 2K |
| `4K` | 2880×2880 | 4K |
| `3840x2160` | 3840×2160 | 4K |

## Gemini 图片模型

Nano Banana 系列运行在 Google 的 Gemini 图片模型上，目前提供五款产品、共七个可调用的模型 ID。同一产品的两个 ID 指向同一个模型，能力与 OmniaKey 价格完全相同，任选其一即可；下方示例默认使用主 ID。图片生成具有随机性，等价 ID 并不保证返回逐字节相同的图片。

| 模型 | 产品 | 支持的 action | OmniaKey 价格 | 说明 |
| - | - | - | - | - |
| `gemini-3.1-flash-image` | Nano Banana 2 | `generate`, `edit` | 1K \$0.019 · 2K \$0.029 · 4K \$0.039 (每次) | 快速完整档 |
| `gemini-nano-banana-2.1` | Nano Banana 2.1 | `generate`, `edit` | 1K \$0.019 · 2K \$0.029 · 4K \$0.039 (每次) | 图片生成与编辑同价，按所选输出尺寸计费。 |
| `gemini-3.1-flash-image-preview` | Nano Banana 2 | `generate`, `edit` | 1K \$0.019 · 2K \$0.029 · 4K \$0.039 (每次) | 同一模型，`-preview` 快照 ID |
| `gemini-3.1-flash-lite-image` | Nano Banana 2 Lite | `generate`, `edit` | \$0.019 (每次) | 1K |
| `gemini-2.5-flash-image` | Nano Banana | `generate`, `edit` | \$0.019 (每次) | 原始 Gemini 2.5 型号 |
| `gemini-3-pro-image` | Nano Banana Pro | `generate`, `edit` | 1K / 2K \$0.039 · 4K \$0.069 (每次) | 文字与排版表现最好 |
| `gemini-3-pro-image-preview` | Nano Banana Pro | `generate`, `edit` | 1K / 2K \$0.039 · 4K \$0.069 (每次) | 同一模型，`-preview` 快照 ID |

### 参数

Gemini 模型与 GPT Image 模型使用不同的参数：

| 字段 | 适用模型 | 取值 |
| - | - | - |
| `parameters.aspect_ratio` | 所有 Gemini 图片模型 | 常用值为 `1:1`、`4:3`、`16:9`、`9:16` |
| `parameters.image_size` | `gemini-3.1-flash-image` | `1K`、`2K`、`4K` |
| `parameters.image_size` | `gemini-nano-banana-2.1` | `1K`、`2K`、`4K` |
| `parameters.image_size` | `gemini-3.1-flash-lite-image` | 仅 `1K` |
| `parameters.image_size` | `gemini-3-pro-image` | `1K`、`2K`、`4K` |
| `parameters.image_size` | `gemini-2.5-flash-image` | 省略；输出固定为 1024px 档 |

这些模型不支持 `size` 和 `mime_type`，传入后会返回可读的错误，而不是被静默忽略。`quality` 会被接受，但它不是 Gemini 的参数，没有任何效果。

```bash theme={null}
curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: nano-banana-2-001" \
  -d '{
    "model": "gemini-3.1-flash-image",
    "type": "image",
    "operation": "generate",
    "input": {"prompt": "a paper boat on a quiet lake at sunset"},
    "parameters": {"aspect_ratio": "16:9", "image_size": "2K"}
  }'
```

轮询和下载与上面的教程完全一致。

### 编辑图片

把源图以内联 Base64 传入，写法与 GPT Image 各路由完全相同：

```bash theme={null}
BASE64=$(base64 -i source.png | tr -d '\n')

curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: nano-banana-edit-001" \
  -d '{
    "model": "gemini-3-pro-image",
    "type": "image",
    "operation": "edit",
    "input": {
      "prompt": "replace the background with a clean studio wall",
      "image": {"data": "'"$BASE64"'", "mime_type": "image/png"}
    },
    "parameters": {"aspect_ratio": "1:1", "image_size": "2K"}
  }'
```

要合成多张照片，把它们都放进 `input.images`，或在 `input.media` 里传链接；详见下文 **多张图片与大图** 一节。

> [!NOTE]
>
> Gemini 模型自行决定输出格式，通常返回 JPEG；GPT Image 模型返回 PNG。请读取完成任务里的 `assets[].mime_type`，不要假设格式。 Nano Banana 2.1：图片生成与编辑同价，按所选输出尺寸计费。

## Qwen 图片模型

Qwen Image 模型运行在阿里巴巴的 Qwen-Image 3 系列上，定位于在画面中渲染中英文文字。

| 模型 | 产品 | 支持的 action | 说明 |
| - | - | - | - |
| `qwen-image-3` | Qwen Image 3 | `generate`, `edit` | 高效的默认选择 |
| `qwen-image-3-pro` | Qwen Image 3 Pro | `generate`, `edit` | 小字与密集版面表现最好 |

### 参数

| 字段 | 常用取值 |
| - | - |
| `parameters.size` | `width*height`, 例如 `1024*1024`, `1280*1280`, `2048*2048` |
| `parameters.prompt_extend` | `true`, `false` |
| `parameters.watermark` | `true`, `false` |

`size` 使用 `*` 分隔而不是 `x`，且必须落在模型支持的范围内（最高 2048×2048）；不传则由模型自动选择。

```bash theme={null}
curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: qwen-image-3-001" \
  -d '{
    "model": "qwen-image-3",
    "type": "image",
    "operation": "generate",
    "input": {"prompt": "一张极简海报，浅米色背景，画面中央用粗体写着 OmniaKey 2026"},
    "parameters": {"size": "1280*1280", "watermark": false}
  }'
```

轮询与下载和上面的流程完全一致。

### 编辑图片

把原图以公网 URL 或 Base64 data URI 放进 `input.images`：

```bash theme={null}
BASE64=$(base64 -i source.png | tr -d '\n')

curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: qwen-image-edit-001" \
  -d '{
    "model": "qwen-image-3-pro",
    "type": "image",
    "operation": "edit",
    "input": {
      "prompt": "把背景换成干净的摄影棚白墙",
      "images": ["data:image/png;base64,'"'"$BASE64"'"]
    },
    "parameters": {"size": "1280*1280", "watermark": false}
  }'
```

> [!NOTE]
>
> Qwen Image 模型返回 PNG。`parameters.n` 必须为 `1`，且 `size` 使用 `*` 分隔而不是 `x`。

## Wan 图片模型

Wan 2.7 Image Pro 运行在阿里巴巴的万相（Wan）系列上；当输出分辨率或品牌色控制比排版更重要时，选它。

| 模型 | 产品 | 支持的 action | 说明 |
| - | - | - | - |
| `wan2.7-image-pro` | Wan 2.7 Image Pro | `generate`, `edit` | 最高 4K，支持品牌色调色盘 |

### 参数

| 字段 | 常用取值 |
| - | - |
| `parameters.size` | `1K`, `2K`, `4K`, or `width*height` |
| `parameters.thinking_mode` | `true`, `false` |
| `parameters.watermark` | `true`, `false` |

`size` 支持 `1K`、`2K`、`4K` 预设，也可以直接写 `宽*高`；4K 仅文生图可用，编辑最高 2K。`parameters.n` 必须为 `1`。

```bash theme={null}
curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: wan2-7-image-001" \
  -d '{
    "model": "wan2.7-image-pro",
    "type": "image",
    "operation": "generate",
    "input": {"prompt": "侧光照射下的纸剧场，电影感光影"},
    "parameters": {"size": "2K", "thinking_mode": true, "watermark": false}
  }'
```

轮询与下载和上面的流程完全一致。

### 编辑图片

把原图以公网 URL 或 Base64 data URI 放进 `input.images`：

```bash theme={null}
BASE64=$(base64 -i source.png | tr -d '\n')

curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: wan2-7-image-edit-001" \
  -d '{
    "model": "wan2.7-image-pro",
    "type": "image",
    "operation": "edit",
    "input": {
      "prompt": "把背景换成干净的摄影棚白墙",
      "images": ["data:image/png;base64,'"'"$BASE64"'"]
    },
    "parameters": {"size": "2K", "watermark": false}
  }'
```

> [!NOTE]
>
> Wan 图片模型返回 PNG。4K 仅支持文生图，且 `parameters.n` 必须为 `1`。

## Seedream 图片模型

Seedream 系列运行在字节跳动的方舟图像 API 上。需要把编辑精确落到某个区域或元素时选 Pro；更看重文生图的量与成本、而不是逐像素控制时选 Lite。

| 模型 | 产品 | 支持的 action | 说明 |
| - | - | - | - |
| `Dola-Seedream-5.0-pro` | Seedream 5.0 Pro | `generate`、`edit` | 定位于精细编辑 |
| `Dola-Seedream-5.0-lite` | Seedream 5.0 Lite | `generate`、`edit` | 单次调用成本更低 |

### 参数

| 字段 | 常用取值 |
| - | - |
| `parameters.size` | Pro：`1K`、`1.5K`、`2K`；Lite：`2K`、`3K`、`4K`；或 `宽x高` |
| `parameters.output_format` | `png`、`jpeg`（Pro） |
| `parameters.watermark` | `true`、`false` |

`parameters.n` 必须为 `1`。两个模型都接受 `input.image` 或 `input.images`，取值可以是公开 URL、Base64 data URL，或带 `data` 与 `mime_type` 的对象。

```bash theme={null}
curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: seedream-001" \
  -d '{
    "model": "Dola-Seedream-5.0-pro",
    "type": "image",
    "operation": "generate",
    "input": {"prompt": "a paper boat on a quiet lake at sunset"},
    "parameters": {"size": "2K"}
  }'
```

### 编辑图片

按与其他模型相同的方式传入原图：

```bash theme={null}
BASE64=$(base64 -i source.png | tr -d '\n')

curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: seedream-edit-001" \
  -d '{
    "model": "Dola-Seedream-5.0-pro",
    "type": "image",
    "operation": "edit",
    "input": {
      "prompt": "replace the background with a clean studio wall",
      "images": ["data:image/png;base64,'"'"$BASE64"'"]
    },
    "parameters": {"size": "2K"}
  }'
```

> [!NOTE]
>
> 字节上游对 Seedream Pro 按输出像素计费，参考图从第 2 张起计费；OmniaKey 仍按模型广场中的固定单次价格收费。默认输出 JPEG；需要无损输出时在 Pro 上把 `parameters.output_format` 设为 `png`。Seedream 的图层分解与批量生成暂不开放。

## Grok 图片模型

Grok Imagine 系列运行在 xAI 的图像 API 上。它们只做生成：任务接收文字提示词并返回一张图片，不支持参考图编辑。

| 模型 | 产品 | 支持的 action | 说明 |
| - | - | - | - |
| `grok-imagine-image` | Grok Imagine | `generate` | 原版 Grok 图像模型 |
| `grok-imagine-image-quality` | Grok Imagine Quality | `generate` | 相同价格下画质更高 |
| `grok-imagine-image-2.0` | Grok Imagine 2.0 | `generate` | 最新的 Grok 图像模型 |

### 参数

| 字段 | 常用取值 |
| - | - |
| `parameters.n` | 必须为 `1` |
| `parameters.size` | 会被接受但不保证生效；请从产物读取真实尺寸 |

```bash theme={null}
curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: grok-imagine-001" \
  -d '{
    "model": "grok-imagine-image-2.0",
    "type": "image",
    "operation": "generate",
    "input": {"prompt": "a robot painting a sunset, highly detailed"}
  }'
```

> [!NOTE]
>
> Grok Imagine 只做生成，因此 `operation: "edit"` 会被拒绝——需要参考图编辑时请改用带 `image-edit` 能力的模型。不同模型的输出尺寸不同（`grok-imagine-image` 为 768×1152，其余为 1024×1024），请从下载的产物读取真实尺寸。三个 Grok 图片模型统一按每次 US\$0.04 计费，每次生成一张图片。

## Midjourney

`midjourney` 是我们的 Midjourney 路由。它只做生成，一次任务返回一张 2048x2048 的 PNG，里面是 2x2 排列的四张候选图，所以要按分钟而不是按秒规划。2026 年 11 月 12 日的实测中，1:1 提示词约三分钟完成，只计一次任务费用。

| 字段 | 常用取值 |
| - | - |
| `parameters.aspectRatio` | `1:1`, `16:9`, `9:16`, `3:2`, `2:3` |
| `parameters.quality` | `1` |
| `parameters.n` | 必须为 `1` |

```bash theme={null}
curl --fail-with-body https://api.omniakey.com/v1/media/tasks \
  -H "Authorization: Bearer your-omniakey-api-key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: midjourney-001" \
  -d '{
    "model": "midjourney",
    "type": "image",
    "operation": "generate",
    "input": {"prompt": "a tall ship under full sail at golden hour, painterly"},
    "parameters": {"aspectRatio": "1:1", "quality": "1", "n": 1}
  }'
```

> [!NOTE]
>
> 上游 botType 已预设，四宫格本身就是产物：保留哪一格就自行裁切或放大。这条路由不提供参考图编辑、融合，也不提供 Midjourney 自带的放大、变体和移动；OpenAI 图片兼容接口同样不提供 `midjourney`。

## 多张图片与大图

GPT Image 和 Gemini 的改图可以合成多张输入图片。把它们以内联 Base64 放进 `input.images`，或像下面这样在
`input.media` 里传公开链接：

```json theme={null}
"input": {
  "prompt": "combine these photos into one collage",
  "media": [
    {"type": "reference_image", "url": "https://example.com/photo-1.jpg"},
    {"type": "reference_image", "url": "https://example.com/photo-2.jpg"}
  ]
}
```

* **请求大小：** 图片任务最大可发 100 MB，内联 Base64 也算在内。视频和音频任务仍是 1 MiB。
* **内联图片：** 请求超过 1 MiB 时，我们会把其中的内联图片私密存储，再以链接形式交给模型。请用 PNG、JPEG 或 WebP。超过 10 MiB 或 2000 万像素、或任一边超过 8192 像素的图片，会先缩小到长边不超过 4096 像素；超过 6400 万像素的图片会被拒绝，返回 `400 invalid_image`。提示词等图片以外的内容仍需控制在 1 MiB 以内。
* **链接：** 请用指向 PNG、JPEG 或 WebP 图片的公开 `https` 链接，每张最大 10 MiB，每个任务合计最大 100 MiB，且需在 60 秒内全部下载完。链接图片不做缩放，原样交给模型。有链接下载失败时，任务会失败，费用退回。
* **时间：** 你的上传和我们的处理需在约 100 秒内完成，否则 Cloudflare 会以 `524` 中断请求。网络慢时，大的内联请求可能超时，所以大图请用链接发送。

2026 年 11 月 16 日的实测中，我们在 `gemini-3.1-flash-image` 和 `gemini-nano-banana-2.1` 上用 20 张内联图片、14 张链接照片改图，在 `gpt-image-2` 上用 2 张链接照片改图，均成功。包含 8 张大照片的 89 MB 内联请求也成功了，但即使网络很快，也用了 80 秒才被受理。

## 费用

按输出图片计费。GPT-Image 2 价格更低，2.6 与 2.5 同价；文生图、图生图按相同分辨率价格收费，质量不加价。

| Model | 1K | 2K | 4K |
| - | -: | -: | -: |
| `gpt-image-2` | \$0.020 | \$0.030 | \$0.050 |
| `gpt-image-2.5-flare` | \$0.025 | \$0.035 | \$0.055 |
| `gpt-image-2.5-sunburst` | \$0.025 | \$0.035 | \$0.055 |
| `gpt-image-2.6-flare` | \$0.025 | \$0.035 | \$0.055 |
| `gpt-image-2.6-sunburst` | \$0.025 | \$0.035 | \$0.055 |

| `quality` | 实测上游输出 token |
| - | - |
| `low` | 约 400 |
| `medium` | 约 1,000–1,700 |
| `high` | 约 6,000 |

当前价格与计费单位请以[实时模型广场](https://omniakey.com/models)为准。

## 常见问题

| 现象 | 原因 | 处理 |
| - | - | - |
| `400 invalid_request` | 请求体格式错误或参数不支持 | 检查 `operation` 和上面的参数取值 |
| `400 model_price_error` | 当前部署没有给该模型配价 | 联系运维配置 |
| `400 invalid_image` | 内联图片超过 6400 万像素，或无法解码 | 换用更小的 PNG、JPEG 或 WebP 图片，或改用链接 |
| `403 model_not_allowed` | 你的 key 或分组不包含该模型 | 检查 key 的模型权限 |
| `413` | 请求超过 100 MB，或图片以外的内容超过 1 MiB | 把大图改成链接，放进 `input.media` |
| `429 upload_busy` | 正在同时处理多个大请求 | 等待 `Retry-After` 给出的秒数，再重发同一个请求 |
| `524` | 上传和处理用时超过约 100 秒 | 把大图改成链接，放进 `input.media` |
| `503 no_available_channel` | 当前没有渠道服务该模型 | 稍后重试或查看控制台 |
| `provider_submit_rate_limited` | 自动重试后供应商仍持续返回 429 | 稍后重新创建任务；失败任务会自动退款 |
| `asset_save_failed` | 无法把已生成的产物持久化到资产存储 | 重新创建任务；失败任务会自动退款 |
| 任务 `failed` 且带其它 `error.code` | 上游拒绝请求或发生其它终态错误 | 查看 `error.message`；预扣会自动退回 |

## 下一步

> [card] [媒体任务](https://docs.omniakey.com/zh/media/overview.md)
>
> 通用生命周期、幂等、计费与限制

> [card] [错误与限流](https://docs.omniakey.com/zh/api/errors.md)
>
> 状态码与排查

> [card] [余额与用量](https://docs.omniakey.com/zh/api/balance-usage.md)
>
> 预付余额与用量记录


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.