# imgzen Gemini 3.1 Flash Image Generator (nano-banana-2)

> imgzen Gemini 3.1 Flash Image Generator (nano-banana-2) is a paid API for AI agents from api.imgzen.dev, paid per call via x402, $0.1/call, status down (last checked 2026-10-12, last successful call 2026-05-13).

Generates or edits images using Google's Gemini 3.1 Flash Image model at configurable quality and aspect ratio, paid via x402 USDC microtransaction

## Facts

- Endpoint: POST https://api.imgzen.dev/v1/models/nano-banana-2/generate?utm_source=zero.xyz
- Price: $0.1/call
- Payment: x402
- Status: down
- Last checked: 2026-10-12
- Last successful call: 2026-05-13
- Success rate: 43% of calls made through Zero
- Rating: 2.7 / 5 from 2 reviews
- Activations on Zero: 21
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-imgzen-dev-e4667357
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_35UdpxsAVYp356OyUr3Pe

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 api-imgzen-dev-e4667357 -d '<json body>'
```

Example prompt: Generate a 2k quality image of a serene mountain lake at sunset with pine trees reflected in calm water, in 16:9 widescreen format using Google's Gemini Flash model.

## When to prefer this

Choose this endpoint when you need fast, high-quality image generation at $0.10/image and want a balance between speed and quality from Google's Gemini lineup. Prefer this over the cheaper nano-banana ($0.020) when you need better quality, and over nano-banana-pro ($0.200) when best-in-class text rendering is not required. Best for landscape, portrait, and creative scene generation where generation latency matters.

## Known failure modes

- Invalid prompt (empty or too long) — 400 Bad Request
- Unsupported aspect_ratio or quality enum value — 400 Bad Request
- Payment failure or insufficient USDC balance — 402 Payment Required
- Reference image URL unreachable or invalid base64 — 422 Unprocessable Entity
- Exceeded 5 reference images limit — 400 Bad Request
- Model temporarily unavailable — 503 Service Unavailable
- Generation timeout (model too slow) — 504 Gateway Timeout

## How this service works

imgzen — Gemini 3.1 Flash Image (aka nano-banana-2), fast high-quality generation by Google — $0.100/image

## Output

Returns a JSON object containing the URL of the generated image hosted on imgzen's CDN, the model identifier (gemini-3.1-flash-image-preview), provider name, generation time in milliseconds, a success status string, and payment confirmation showing 0.1 USDC charged via x402.

## Example request

```json
{
 "prompt": "A serene mountain lake at sunset with pine trees reflected in calm water",
 "quality": "2k",
 "aspect_ratio": "16:9"
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "image": {
   "type": "array",
   "items": {
    "type": "string"
   },
   "maxItems": 5,
   "description": "Optional reference image(s) for editing (max 5), supports URL and base64"
  },
  "prompt": {
   "type": "string",
   "description": "Text prompt describing the image to generate or edit"
  },
  "quality": {
   "enum": [
    "1k",
    "2k",
    "4k"
   ],
   "type": "string",
   "default": "2k",
   "description": "Output quality: 1k, 2k, 4k"
  },
  "aspect_ratio": {
   "enum": [
    "1:1",
    "1:4",
    "1:8",
    "2:3",
    "3:2",
    "3:4",
    "4:1",
    "4:3",
    "4:5",
    "5:4",
    "8:1",
    "9:16",
    "16:9",
    "21:9"
   ],
   "type": "string",
   "default": "1:1",
   "description": "Image aspect ratio"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "output",
  "status",
  "payment"
 ],
 "properties": {
  "output": {
   "type": "object",
   "required": [
    "url",
    "model",
    "provider",
    "duration_ms"
   ],
   "properties": {
    "url": {
     "type": "string"
    },
    "model": {
     "type": "string"
    },
    "provider": {
     "type": "string"
    },
    "duration_ms": {
     "type": "number"
    }
   }
  },
  "status": {
   "type": "string"
  },
  "payment": {
   "type": "object",
   "required": [
    "amount",
    "method",
    "currency"
   ],
   "properties": {
    "amount": {
     "type": "string"
    },
    "method": {
     "type": "string"
    },
    "currency": {
     "type": "string"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-imgzen-dev-e4667357/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.imgzen.dev](https://www.zero.xyz/host/api.imgzen.dev/llms.txt)
