ApiframeApiframe Docs
Image GenerationNano Banana

Nano Banana 2

High-efficiency image generation with accurate text rendering, Google Search grounding, and resolutions up to 4K.

Use in Apiframe Studio

POST /v2/images/generatemodel: "nano-banana-2"

Google's latest high-efficiency image generation model built on Gemini 3.1 Flash Image. Combines Pro-level visual quality with Flash-level speed. Supports accurate text rendering, up to 14 reference images, resolutions up to 4K, and optional Google Search grounding for real-time context.

See Image Generation overview for common request fields, response format, and error codes.

Model-specific parameters

ParameterTypeDescription
nanoBananaParams.aspect_ratiostring"match_input_image" or "W:H" format (e.g. "16:9")
nanoBananaParams.output_formatstring"jpg" (default) or "png"
nanoBananaParams.image_inputstring[]Up to 14 reference image URLs
nanoBananaParams.resolutionstring"512px", "1K" (default), "2K", or "4K"
nanoBananaParams.google_searchbooleanUse Google Web Search grounding for real-time information
nanoBananaParams.image_searchbooleanUse Google Image Search for visual context

Credit cost

ResolutionCredits
1K12
2K18
4K26

512px is billed at the 1K rate.

Example result

Once the job is COMPLETED, the result object on GET /v2/jobs/:id looks like:

{
  "images": [
    "https://cdn2.apiframe.ai/images/a1b2c3d4-e5f6-7890-abcd-ef1234567890-1.png"
  ]
}

See Result format for field details.

Code examples

Text-to-image

curl -X POST https://api.apiframe.ai/v2/images/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a photorealistic cityscape at golden hour",
    "model": "nano-banana-2",
    "nanoBananaParams": {
      "resolution": "2K",
      "output_format": "png"
    }
  }'
import requests

response = requests.post(
    "https://api.apiframe.ai/v2/images/generate",
    headers={
        "X-API-Key": "afk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={
        "prompt": "a photorealistic cityscape at golden hour",
        "model": "nano-banana-2",
        "nanoBananaParams": {
            "resolution": "2K",
            "output_format": "png",
        },
    },
)
print(response.json())
const response = await fetch("https://api.apiframe.ai/v2/images/generate", {
  method: "POST",
  headers: {
    "X-API-Key": "afk_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    prompt: "a photorealistic cityscape at golden hour",
    model: "nano-banana-2",
    nanoBananaParams: {
      resolution: "2K",
      output_format: "png",
    },
  }),
});
console.log(await response.json());

With Google Search grounding

curl -X POST https://api.apiframe.ai/v2/images/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "infographic of today's weather in Paris",
    "model": "nano-banana-2",
    "nanoBananaParams": {
      "google_search": true,
      "resolution": "1K"
    }
  }'
import requests

response = requests.post(
    "https://api.apiframe.ai/v2/images/generate",
    headers={
        "X-API-Key": "afk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={
        "prompt": "infographic of today's weather in Paris",
        "model": "nano-banana-2",
        "nanoBananaParams": {
            "google_search": True,
            "resolution": "1K",
        },
    },
)
const response = await fetch("https://api.apiframe.ai/v2/images/generate", {
  method: "POST",
  headers: {
    "X-API-Key": "afk_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    prompt: "infographic of today weather in Paris",
    model: "nano-banana-2",
    nanoBananaParams: {
      google_search: true,
      resolution: "1K",
    },
  }),
});

Try it

POST/v2/images/generateTry it

On this page