---
name: api.imgzen.dev
description: api.imgzen.dev is a text-to-image generation API offering four model endpoints — NanoBanana, NanoBanana 2, Nano Banana Pro, and GPT-Image-2 — each returning a CDN-hosted image URL. All endpoints are billed per-request via x402 payments in USDC on Base (ranging from ~$0.02 to $0.20). No image editing, inpainting, or video generation is supported.
host: api.imgzen.dev
---

# api.imgzen.dev

ImgZen is a pay-per-request image generation host serving agents that need to produce images from text prompts without managing model infrastructure. It exposes multiple model tiers under a consistent API surface, allowing agents to trade off cost against capability. The host is distinct in its native x402 micropayment integration on Base, making it suitable for autonomous agents that handle on-chain payments.

## When to use this host

Use api.imgzen.dev when an agent needs to generate new images from text prompts and can pay per-request in USDC on Base via x402. Choose generate-image-nano-banana for the lowest cost (~$0.02), generate-image-nano-banana-2 for mid-tier quality ($0.10), generate-nano-banana-pro-image for the highest NanoBanana quality ($0.20), or generate-image-gpt-image-2 when GPT-Image-2 output or reference-image grounding is required. Do not use this host for image editing, inpainting, upscaling, or video generation — those capabilities are absent entirely. Do not use it for batch generation workflows that cannot handle per-request x402 payment flows. If free or subscription-based image generation is needed, this host is not appropriate.

## Capabilities

### Text-to-Image Generation

All four skills generate new images from text prompts and return CDN-hosted URLs. They differ by underlying model, cost, and available input controls such as quality, aspect ratio, style, background, and optional reference images.

- **`generate-image-nano-banana`** — Generates an image from a text prompt using the Nano-Banana model (backed by gemini-2.5-flash-image) and returns a CDN URL to the rendered asset.
- **`generate-image-nano-banana-2`** — Generates an image from a text prompt using the Nano-Banana-2 model and returns a CDN URL to the resulting JPEG, billed at 0.10 USDC per request on Base.
- **`generate-nano-banana-pro-image`** — Generates an image using the Nano Banana Pro model via a paid API endpoint on imgzen.dev, billed at 0.20 USDC per request on Base.
- **`generate-image-gpt-image-2`** — Generates an image using GPT-Image-2 via the ImgZen API, accepting a text prompt and optional reference image URL, returning a CDN-hosted image URL.

## Workflows

### Model Tier Escalation

*Use when an agent needs to generate an image at the lowest cost first and escalate to a higher-quality model if the initial result is insufficient.*

1. **`generate-image-nano-banana`** — Generate an initial image cheaply (~$0.02 USDC) using the base NanoBanana model to validate the prompt and composition.
2. **`generate-image-nano-banana-2`** — If the base result is inadequate, regenerate at $0.10 USDC using NanoBanana 2 for improved quality.
3. **`generate-nano-banana-pro-image`** — If further quality is needed, escalate to Nano Banana Pro at $0.20 USDC for the highest-tier NanoBanana output.

### Reference-Grounded Image Generation

*Use when an agent needs to generate an image that is stylistically or compositionally grounded in an existing image URL, then optionally refine with a different model.*

1. **`generate-image-gpt-image-2`** — Generate an initial image using GPT-Image-2 with a reference image URL and text prompt to establish style or subject grounding.
2. **`generate-image-nano-banana-2`** — Use the returned CDN URL as a reference input to NanoBanana 2 to produce a cost-effective variant of the grounded image.

## Skill reference

### `generate-image-nano-banana-2`

**NanoBanana 2 Image Generator** — Generates an image from a text prompt using the Nano-Banana-2 model and returns a CDN URL to the resulting JPEG, billed at 0.10 USDC per request on Base.

*Use when:* Use when an agent needs to generate a new image from a text prompt and retrieve a direct URL to the rendered output; supports quality and aspect ratio controls.

*Not for:* Do not use for image editing, inpainting, or upscaling existing images; this endpoint generates new images from text only.

**Inputs:**

- `prompt` (string, required) — Text description of the image to generate. Detailed, descriptive prompts yield better results.
- `quality` (string) — Output resolution quality level.
- `aspect_ratio` (string) — Desired aspect ratio of the generated image.
- `image` (array) — Array of reference images; pass empty array if not providing reference images.

**Returns:** Returns status='success', a CDN URL to the generated JPEG, the provider and model used, generation duration in milliseconds, and payment confirmation of 0.10 USDC via x402.

**Example:** `{"prompt": "A detailed, photorealistic image of a cute cat sitting on a small patch of moon dust, wearing a simple astronaut helmet with a clear visor. The cat looks curious, with subtle fur detail and soft rim lighting. Background: the Earth hangs in the black sky, tiny stars scattered naturally, gentle lunar shadows, high contrast, crisp focus, cinematic color grading.", "quality": "2k", "aspect_ratio": "1:1", "image": []}`

---

### `generate-image-gpt-image-2`

**ImageZen GPT-Image-2 Generator** — Generates an image using GPT-Image-2 via the ImgZen API, accepting a text prompt and optional reference image URL, returning a CDN-hosted image URL.

*Use when:* Use when an agent needs to generate or transform an image using GPT-Image-2, given a descriptive text prompt and optionally one or more reference image URLs for style or subject grounding.

*Not for:* Do not use for real-time streaming image generation or video generation; this is a single-shot image generation endpoint only.

**Inputs:**

- `prompt` (string, required) — Text description of the image to generate.
- `image` (array) — Array of reference image objects, each with a 'url' key pointing to a publicly accessible image URL.
- `image_url` (string) — Single reference image URL to use as input for the generation.
- `style` (string) — Style descriptor string to guide the visual style of the output.
- `quality` (string) — Quality level for the generated image.
- `background` (string) — Description of the background scene or environment for the generated image.
- `aspect_ratio` (string) — Desired aspect ratio of the output image.
- `output_format` (string) — File format for the output image.

**Returns:** Returns a success status with a CDN URL to the generated PNG, the model and provider used, generation duration in ms, and the USDC payment amount charged (0.10 USDC).

**Example:** `{"prompt": "A photorealistic scene of a tiny astronaut ant standing on the moon's dusty regolith with dramatic lighting and a faint Earth in the background.", "image": [{"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Camponotus_flavomarginatus_ant.jpg/640px-Camponotus_flavomarginatus_ant.jpg"}], "quality": "high", "aspect_ratio": "1:1", "output_format": "png"}`

---

### `generate-image-nano-banana`

**NanoBanana ImageGen** — Generates an image from a text prompt using the Nano-Banana model (backed by gemini-2.5-flash-image) and returns a CDN URL to the rendered asset.

*Use when:* Use when an agent needs to produce a new image from a text description, optionally specifying quality and aspect ratio, and can pay ~$0.02 USDC per generation via x402 on Base.

*Not for:* Do not use for image editing, inpainting, or upscaling existing images; this endpoint is text-to-image generation only.

**Inputs:**

- `prompt` (string, required) — Text description of the image to generate. Be specific about style, lighting, and content. No text, logos, or watermarks are recommended for best results.
- `quality` (string) — Output resolution quality tier. Known accepted value: '1k'.
- `aspect_ratio` (string) — Desired aspect ratio of the output image (e.g. '1:1', '16:9').
- `image` (array) — Array of reference images (usage details not fully specified; pass empty array if unused).

**Returns:** Returns status='success', a CDN PNG URL, the provider and model used (gemini-2.5-flash-image), generation duration in ms, and the USDC payment amount charged.

**Example:** `{"prompt": "Illustrate a calm, professional cat in a small spacesuit standing on a bright, detailed moon surface at golden hour. The scene should feel high-quality and realistic, with subtle lunar dust, crisp textures, and soft cinematic lighting. No text, no logos, no watermark.", "quality": "1k", "aspect_ratio": "1:1", "image": []}`

---

### `generate-nano-banana-pro-image`

**Nano Banana Pro Image Generation** — Generates an image using the Nano Banana Pro model via a paid API endpoint on imgzen.dev, billed at 0.20 USDC per request on Base.

*Use when:* Use when an agent needs to generate an image using the Nano Banana Pro model and is prepared to pay 0.20 USDC (USDC on Base, EIP-155 chain 8453) per generation request.

*Not for:* Do not use for free or unpaid image generation, or when a different model is required. Not suitable for batch generation without handling per-request x402 payments.

**Inputs:**

- `prompt` (string, required) — Text prompt describing the image to generate. Exact parameter name not confirmed in schema; inferred from standard image generation API conventions.

**Returns:** Returns generated image data or a URL for the image produced by the Nano Banana Pro model.

**Example:** `{"prompt": "A surreal banana floating in space with neon colors"}`

---
