Gemini 图像
- 文生图与参考图编辑
- 参考图最多 14 张,单张 30MB
- 支持 1K / 2K / 4K 三档输出
认证
All endpoints authenticate with a Bearer token.
Get an API key: open the console and create one.
Add it to the request header:
Authorization: Bearer YOUR_OAIRoute_KEY请求结构
请求体是平铺的 JSON,创作字段与输出字段都在顶层,没有 content 数组包装。
The body is flat JSON: creative fields and output fields sit at the top level, with no content array wrapper.
支持的场景
| 场景 | 字段组合 |
|---|---|
| 文生图 | prompt |
| 单图编辑 | prompt + image(1 张) |
| 多图参考 | prompt + image(2 到 14 张) |
带 image 即进入图生图,不需要额外参数切换。
| Scenario | Field combination |
|---|---|
| Text to image | prompt |
| Single-image edit | prompt + image (1 image) |
| Multi-image reference | prompt + image (2 to 14 images) |
Including image switches to image-to-image; no extra parameter is needed.
请求参数
提交成功只返回任务 ID,不含图片本身。拿结果用 task_id 轮询获取任务状态,图片地址在 result.images[0].url,该地址会过期,请及时转存。
取值 gemini-3-pro-image-preview 或 gemini-3-pro-image-preview-official。
nano-banana-pro 与 nano-banana-pro-ext 是等价别名。
画面描述。
宽高比,取值 auto、1:1、2:3、3:2、3:4、4:3、4:5、5:4、9:16、16:9、21:9。
auto 在文生图下回落为 1:1 或 16:9,图生图下跟随上游返回比例。建议显式指定。
取值 1K(默认)、2K、4K。
只能是 1。必须传数字。
参考图,最多 14 张。公网地址或完整 Base64 Data URI(前缀 data:image/jpeg;base64, 等不能省)。
单张不超过 30MB,格式 jpeg、jpg、png、webp。
允许回落到官方通道,默认 false。不能与官方模型同时使用。
为 true 时先做内容审查,默认 false。
A successful submission returns only the task ID, not the image itself. Poll Get task status with the task_id; the image URL is at result.images[0].url and expires, so copy it promptly.
gemini-3-pro-image-preview or gemini-3-pro-image-preview-official.
nano-banana-pro and nano-banana-pro-ext are equivalent aliases.
The scene description.
Aspect ratio: auto, 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9.
auto falls back to 1:1 or 16:9 for text to image, and follows the upstream ratio for image to image. Specifying it explicitly is recommended.
1K (default), 2K, or 4K.
Must be 1, and must be a number.
Reference images, up to 14. Public URLs or complete Base64 Data URIs (the data:image/jpeg;base64, prefix can't be omitted).
At most 30MB each, in jpeg, jpg, png, or webp.
Allows falling back to the official channel; defaults to false. Can't be used together with official models.
When true, runs a content check first. Defaults to false.
输出尺寸参考
| 比例 | 1K | 2K | 4K |
|---|---|---|---|
| 1:1 | 1024×1024 | 2048×2048 | 4096×4096 |
| 16:9 | 1376×768 | 2752×1536 | 5504×3072 |
| 9:16 | 768×1376 | 1536×2752 | 3072×5504 |
| 21:9 | 1584×672 | 3168×1344 | 6336×2688 |
以返回文件的实际尺寸为准。
| Ratio | 1K | 2K | 4K |
|---|---|---|---|
| 1:1 | 1024×1024 | 2048×2048 | 4096×4096 |
| 16:9 | 1376×768 | 2752×1536 | 5504×3072 |
| 9:16 | 768×1376 | 1536×2752 | 3072×5504 |
| 21:9 | 1584×672 | 3168×1344 | 6336×2688 |
The actual dimensions of the returned file take precedence.
响应
提交成功返回受理结构:
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
}
]
}状态码,200 表示任务已受理。
本次提交的任务列表。
受理状态,提交成功时为 submitted。
任务 ID,用它轮询结果。
完成态返回:
{
"code": 200,
"data": {
"id": "task_01K8SGYNNNVBQTXNR4MM964S7K",
"status": "completed",
"progress": 100,
"result": {
"images": [
{ "url": ["https://cdn.oairoute.com/f/image/task_01K8_0.png"], "expires_at": 1763174708 }
]
},
"created": 1763088289,
"completed": 1763088302
}
}A successful submission returns an accepted structure:
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
}
]
}The status code; 200 means the task was accepted.
The list of tasks submitted this time.
The acceptance status; submitted on success.
The task ID; use it to poll for the result.
The completed state returns:
{
"code": 200,
"data": {
"id": "task_01K8SGYNNNVBQTXNR4MM964S7K",
"status": "completed",
"progress": 100,
"result": {
"images": [
{ "url": ["https://cdn.oairoute.com/f/image/task_01K8_0.png"], "expires_at": 1763174708 }
]
},
"created": 1763088289,
"completed": 1763088302
}
}错误码
| HTTP | 含义 |
|---|---|
| 400 | 参数错误,type 为 invalid_request_error |
| 401 | Token 缺失或无效,type 为 authentication_error |
| 402 | 余额不足,type 为 payment_required |
| 429 | 触发限流 |
| HTTP | Meaning |
|---|---|
| 400 | Invalid parameters, with type invalid_request_error |
| 401 | Token missing or invalid, with type authentication_error |
| 402 | Insufficient balance, with type payment_required |
| 429 | Rate limit hit |
For more status codes and retry guidance see Error codes and rate limits; for troubleshooting steps on common errors see the FAQ.
支持的模型列表
| 模型 ID | 定位 |
|---|---|
gemini-3-pro-image-preview | 当前主力,最高 4K |
gemini-3-pro-image-preview-official | 官方通道版本,输出一致 |
nano-banana-pro | gemini-3-pro-image-preview-official 的别名 |
nano-banana-pro-ext | gemini-3-pro-image-preview 的别名 |
别名与主名行为完全一致,可以互换。
GET https://api.oairoute.com/api/pricing。| Model ID | Positioning |
|---|---|
gemini-3-pro-image-preview | Current main model, up to 4K |
gemini-3-pro-image-preview-official | Official-channel version, identical output |
nano-banana-pro | Alias for gemini-3-pro-image-preview-official |
nano-banana-pro-ext | Alias for gemini-3-pro-image-preview |
Aliases behave identically to their canonical names and are interchangeable.
GET https://api.oairoute.com/api/pricing.