# Generate Images via Google Gemini 3.1 Flash (Nano Banana 2)

> Generate Images via Google Gemini 3.1 Flash (Nano Banana 2) is a paid API for AI agents from image.withzero.xyz, paid per call via MPP, $0.07/call, status healthy (last checked 2026-09-15, last successful call 2026-09-14).

Generates 1–4 images from a text prompt using Google's Gemini 3.1 Flash Image model and returns hosted image URLs.

## Facts

- Endpoint: POST https://image.withzero.xyz/api/v1/images/nano-banana-2
- Price: $0.07/call
- Payment: MPP
- Status: healthy
- Last checked: 2026-09-15
- Last successful call: 2026-09-14
- Success rate: 97% of calls made through Zero
- Rating: 4.2 / 5 from 6 reviews
- Activations on Zero: 184
- Provider: image.withzero.xyz
- Website: https://image.withzero.xyz
- Canonical page: https://www.zero.xyz/c/image-withzero-xyz-generate-images-via-google-gemini-3-1-flash-nano-a910a17d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_EjNHKZYP-78BNv3FPrfOv

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability image-withzero-xyz-generate-images-via-google-gemini-3-1-flash-nano-a910a17d -d '<json body>'
```

Example prompt: Using the Nano Banana 2 Gemini Flash model, generate 2 images of a sun-drenched Tuscan vineyard at golden hour with rolling hills and cypress trees in the background.

## When to prefer this

Choose this endpoint when you need fast, cost-effective image generation using Google's Gemini 3.1 Flash Image model and want results returned as hosted URLs. Prefer over the Nano Banana Pro variant when speed is prioritized over maximum quality, and over OpenAI GPT-5 Image when Google's model style is preferred.

## Known failure modes

- Prompt exceeds 4000 character limit — request rejected with validation error
- Count outside 1–4 range — request rejected with validation error
- Model unavailable or overloaded — upstream error from Google Gemini
- Prompt violates content policy — generation refused with policy error
- Empty or missing prompt — validation error returned

## How this service works

Generate images from a text prompt with Google's Nano Banana 2 (Gemini 3.1 Flash Image) — fast, high-quality generation. Returns hosted image URLs.

## Output

Returns an array of generated images, each with a hosted URL, MIME type, and file size in bytes, along with the model name used and the USDC amount charged for the request.

## Example request

```json
{
 "count": 2,
 "prompt": "A serene mountain landscape at sunrise with snow-capped peaks, a calm alpine lake reflecting the sky, and pine forests in the foreground"
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "example": {
  "count": 1,
  "prompt": "A watercolor painting of a lighthouse at sunrise"
 },
 "required": [
  "prompt",
  "count"
 ],
 "properties": {
  "count": {
   "type": "integer",
   "default": 1,
   "maximum": 4,
   "minimum": 1,
   "description": "How many images to generate (1–4)."
  },
  "prompt": {
   "type": "string",
   "maxLength": 4000,
   "minLength": 1,
   "description": "Text description of the image to generate."
  }
 },
 "additionalProperties": false
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "images",
  "model",
  "price_usdc"
 ],
 "properties": {
  "model": {
   "type": "string",
   "description": "The model that produced the images."
  },
  "images": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "url",
     "mimeType",
     "sizeBytes"
    ],
    "properties": {
     "url": {
      "type": "string"
     },
     "mimeType": {
      "type": "string"
     },
     "sizeBytes": {
      "type": "number"
     }
    },
    "additionalProperties": false
   },
   "description": "The generated images, as hosted URLs."
  },
  "price_usdc": {
   "type": "string",
   "description": "The amount charged for this request, in USDC."
  }
 },
 "additionalProperties": false
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/image-withzero-xyz-generate-images-via-google-gemini-3-1-flash-nano-a910a17d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from image.withzero.xyz](https://www.zero.xyz/host/image.withzero.xyz/llms.txt)
