# Nanobanana x402 AI Image Generation

> Nanobanana x402 AI Image Generation is a paid API for AI agents from nanobanana-x402.fly.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-15).

Generates AI images from a text prompt via micropayment (x402/Base USDC), returning a base64-encoded PNG at a chosen aspect ratio powered by Gemini.

## Facts

- Endpoint: POST https://nanobanana-x402.fly.dev/api/edit-image
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 1
- Tags: x402
- Canonical page: https://www.zero.xyz/c/nanobanana-x402-ai-image-generation-8c6456e1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_SXbqbTMaLO-vzfM9TAZ0D

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 nanobanana-x402-ai-image-generation-8c6456e1 -d '<json body>'
```

Example prompt: Generate a product hero image of a sleek black coffee mug on a marble countertop with soft morning light, in 16:9 widescreen format — pay the per-image fee automatically.

## When to prefer this

Choose this endpoint when you need pay-per-use AI image generation with no subscription, billed in USDC micropayments via the x402 protocol on Base. Ideal for agents that need to generate images on demand without managing API keys for Gemini directly, and where cost predictability ($0.01 per image) matters. Prefer this over self-managed Gemini API calls when the agent stack already supports x402 payment flows.

## Known failure modes

- Payment failure or insufficient USDC balance — x402 payment not completed, image not generated
- Invalid aspect ratio value — must be one of the 10 supported enum values
- Missing or empty prompt — returns error without generating an image
- Gemini API downstream error — model unavailable or rate-limited
- Network timeout on the fly.dev host — request may need to be retried

## How this service works

Generate or edit an image with Gemini and receive base64 PNG output through a pay-per-request API.

## Output

A JSON object containing a base64-encoded PNG image (image_b64), the MIME type (image/png), the aspect ratio used, the Gemini model name used, and an echo of the input parameters. The image can be decoded and used directly.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "prompt": {
   "type": "string",
   "minLength": 3,
   "description": "Text prompt describing the image to generate"
  },
  "aspectRatio": {
   "enum": [
    "1:1",
    "16:9",
    "9:16",
    "3:2",
    "2:3",
    "4:3",
    "3:4",
    "4:5",
    "5:4",
    "21:9"
   ],
   "type": "string",
   "description": "Output aspect ratio (default: 1:1)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "input": {
   "type": "http",
   "method": "POST",
   "bodyFields": {
    "prompt": "A product hero image for a Telegram breach monitor, neon terminal style",
    "aspectRatio": "16:9"
   }
  },
  "model": "gemini-3.1-flash-image-preview",
  "image_b64": "iVBORw0KGgoAAAANSUhEUgAA...",
  "mime_type": "image/png",
  "aspectRatio": "1:1"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/nanobanana-x402-ai-image-generation-8c6456e1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from nanobanana-x402.fly.dev](https://www.zero.xyz/host/nanobanana-x402.fly.dev/llms.txt)
