快速结论

  • Supports prompt-based text-to-image workflows for marketing and creative assets.
  • Supports reference-guided generation for stronger style consistency.
  • Stabilize parameters in this guide first, then move into production API.

关键参数

  • model | string | 必填 | nano-banana-2 | - | Exact model identifier from ToAPIs.
  • prompt | string | 必填 | - | - | Primary image instruction prompt.
  • size | string | 可选 | 1:1 | - | Output aspect ratio, model-dependent.
  • n | integer | 可选 | 1 | - | Number of generated images per request.
  • reference_images | file[] | 可选 | - | - | Reference images for style consistency.

常见错误

  • 400 invalid_request_error: 触发=Missing or invalid payload fields.; 修复=Validate model/prompt/size payload fields.; 重试=Retry only after payload fix.
  • 401 authentication_error: 触发=Missing or invalid API key.; 修复=Verify Authorization header and key scope.; 重试=Retry after authentication fix.

模型解析页

Nano Banana 2

模型 ID: nano-banana-2

厂商: Unknown能力类型: Image价格: $0.0250 /request更新于: 2026-05-02

Nano Banana 2 by Unknown is optimized for image generation/editing workflows. Contracts follow ToAPIs docs for production-ready API integration.

模型概览

快速结论

  • Supports prompt-based text-to-image workflows for marketing and creative assets.
  • Supports reference-guided generation for stronger style consistency.
  • Stabilize parameters in this guide first, then move into production API.

Nano Banana 2模型特点

核心能力

能力一览与工程实践价值

High-quality generation

Generate production-ready visual assets via a unified API.

Reference consistency

Use references to stabilize style and composition.

Parameter tuning

Tune ratio/count/sampling for quality and cost balance.

如何使用 Nano Banana 2 API

  1. Set Authorization: Bearer <YOUR_API_KEY>.
  2. Call image generation endpoint with model, prompt, and size.
  3. Optionally pass reference_images for stronger consistency.
  4. Poll task status and download output URLs.
Nano Banana 2

适用场景

  • When generating marketing, e-commerce, and social visual assets quickly.
  • When reference-guided consistency is required.

API 运行特性

  • Uses unified image generation endpoints with task-style responses.
  • Poll task status and fetch result URLs after completion.
Nano Banana 2

关键参数

参数类型必填默认值取值范围说明
modelstringnano-banana-2-Exact model identifier from ToAPIs.
promptstring--Primary image instruction prompt.
sizestring1:1-Output aspect ratio, model-dependent.
ninteger1-Number of generated images per request.
reference_imagesfile[]--Reference images for style consistency.

常见错误

400 invalid_request_error

触发条件: Missing or invalid payload fields.

修复建议: Validate model/prompt/size payload fields.

重试策略: Retry only after payload fix.

401 authentication_error

触发条件: Missing or invalid API key.

修复建议: Verify Authorization header and key scope.

重试策略: Retry after authentication fix.

Nano Banana 2

FAQ

What is Nano Banana 2 best for?

Best for high-frequency creative generation and reference-guided consistency workflows.

图像视频模型报错:invalid apitype: -1

这类错误通常说明接口走错了。图像和视频模型一般不走 chat 接口,而是按对应文档发起 HTTP 任务请求,并通过任务状态接口轮询结果。排查时建议先看用户的实际请求代码、请求地址和请求体。

用户进行生成图片/视频的任务时出现任务失败,但是扣款

先让用户提供任务日志或截图,重点看是否出现了输入或输出 token 统计。如果有这类 token 记录,大概率是用户把图片/视频模型走成了 chat 接口;这不是正确用法。图片和视频模型通常是异步任务接口,需要通过 HTTP 请求先提交任务,再拿到任务 ID 轮询状态,详细以对应文档为准。

模式说明

Text to Image 模式(Nano Banana 2)

Generate images directly from prompt instructions.

模式参数

modelpromptsizen

最佳应用场景

  • Product key visuals
  • Ad creatives
  • Concept art

Reference-guided Image 模式(Nano Banana 2)

Use references to generate style-consistent outputs.

模式参数

reference_imagespromptsizen

最佳应用场景

  • Brand consistency
  • Character consistency
  • Series posters

相关 API

準備好開始了嗎?

免費註冊,立即體驗企業级 AI API 網關的強大功能