Skip to content

Image Generation nano-banana

Overview

  • Method: POST
  • Path: /v1/images/generations

Authentication

  • Use HTTP Bearer Token, e.g.: Authorization: Bearer sk-xxxxx

Request Parameters

ParameterTypeRequiredDescription
promptstringYesText prompt, max 32768 tokens
modelstringYese.g. nano-banana / gemini-3.1-flash-image-preview / gemini-2.5-flash-image
response_formatstringNob64_json/url
sizestringNoe.g. 2:3, 4K, etc.
aspect_ratiostringNoAspect ratio e.g. 2:3 (only supported for 3+ series)

Request Example

json
{
  "model": "nano-banana",
  "prompt": "A realistic high-resolution photo of a busy city street",
  "size": "2:3"
}

Response Example

json
{
  "created": 1725007743,
  "data": [{"b64_json": "..."}],
  "usage": {"input_tokens": 10, "output_tokens": 20, "total_tokens": 30}
}