预览提示 · 本站为上线前预览:模型清单与费率以正式上线公告为准

MODEL API · Google · 图像

Nano Banana 2 API:1.9c ≈ $0.019 / 1K 分辨率图像起

Google 高速图像生成与编辑款:出图快、单价低,文生图与图生图双模式,批量管线与风格 A/B 迭代首选。

正式版 3 条并行通道 免费获取 API Key →

Nano Banana 2 API 调用示例

统一任务接口 /videos
# Nano Banana 2 · 统一任务接口(图像与视频同端点 /videos)
curl https://api.modapis.com/v1/videos \
  -H "Authorization: Bearer $MODAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nano-banana-2",
    "prompt": "一只戴圆框眼镜的橘猫在书桌前看书,暖光,插画风格"
  }'

# 轮询:GET https://api.modapis.com/v1/videos/{id} → status:"completed" 后取顶层 url
import os, requests, time

API = "https://api.modapis.com/v1"
H = {"Authorization": f"Bearer {os.environ['MODAPIS_API_KEY']}"}

def call(method, url, **kw):              # 统一出口:非 200 直接给可读错误
    r = requests.request(method, url, headers=H, timeout=60, **kw)
    if r.status_code != 200:
        raise SystemExit(f"HTTP {r.status_code}: {r.text}")  # 401 = Key 无效/被吊销
    return r.json()

task = call("POST", f"{API}/videos", json={
    "model": "nano-banana-2",
    "prompt": "一只戴圆框眼镜的橘猫在书桌前看书,暖光,插画风格",
})

while task["status"] != "completed":        # queued → in_progress → completed
    if task["status"] == "failed":
        raise SystemExit(task.get("error"))  # 失败终态:message + code
    time.sleep(3)
    task = call("GET", f"{API}/videos/{task['id']}")

print(task["url"])                          # 成品地址在顶层 url 字段
const API = "https://api.modapis.com/v1";
const H = { Authorization: `Bearer ${process.env.MODAPIS_API_KEY}` };

const call = async (url, opts = {}) => {
  const r = await fetch(url, { headers: H, ...opts });
  if (!r.ok) throw new Error(`HTTP ${r.status}: ${await r.text()}`);
  return r.json();
};

let task = await call(`https://api.modapis.com/v1/videos`, {
  method: "POST",
  body: JSON.stringify({ model: "nano-banana-2", prompt: "一只戴圆框眼镜的橘猫在书桌前看书,暖光,插画风格" }),
});

while (task.status !== "completed") {        // queued → in_progress → completed
  if (task.status === "failed") throw new Error(JSON.stringify(task.error));
  await new Promise(r => setTimeout(r, 3000));
  task = await call(`https://api.modapis.com/v1/videos/${task.id}`);
}
console.log(task.url);                       // 成品地址在顶层 url 字段
鉴权:Bearer $MODAPIS_API_KEY 文档中心 → /docs/quickstart

Nano Banana 2 能力与规格

维度 Nano Banana 2
输入模式 文生图 t2i · 图生图 i2i
输出 1K 分辨率图像
任务接口 POST /v1/videos · 与视频同一任务接口
上游通道 3 条并行 · 自动择优,异常 30 秒内切换
计价 按张计 credits · 失败不计费

Nano Banana 2 API 常见问题

Nano Banana 2 API 一次调用多少 credits?
按 credits 计费:1.9 credits(≈$0.019)。全站公开锚点 1 credit = $0.01,无隐藏倍率;失败请求不计费。注册 Free 档送 50 credits 可直接试跑。
Nano Banana 2 有免费试用吗?
有。Sandbox 免注册用 mock 通道试跑 Nano Banana 2,零成本;注册 ModAPIS(OAuth)Free 档送 50 credits 一次性,可用真通道调用 Nano Banana 2。
怎么从其他平台迁移到 ModAPIS?
把 base_url 换成 https://api.modapis.com/v1、model 换成 Nano Banana 2 的模型 ID 即可:视频与图像统一走 /v1/videos 任务接口(提交、轮询、webhook),请求体字段风格与 OpenAI 一致。参考本页 curl / Python / JS 示例。
Nano Banana 2 的通道稳定吗?
Nano Banana 2 在 ModAPIS 有 3 条并行通道,按延迟与成功率实时排序,异常 30 秒内自动切换;通道健康度在状态页实时公开。

一个 Key,五分钟后跑通全部模型

Sandbox 免注册先试,Free 档 50 credits 起步,无需绑卡。

已复制