# agent402.tools Image Generation

> agent402.tools Image Generation is a paid API for AI agents from agent402.tools, paid per call via x402, $0.08/call, status unknown (last checked 2026-09-14).

Generates images from text prompts using Gemini 2.5 Flash Image, via an OpenAI-compatible API endpoint paid with USDC over x402 — no API key required.

## Facts

- Endpoint: POST https://agent402.tools/v1/images/generations
- Price: $0.08/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-image-generation-ee55d9f9
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_CqMJxpgF3byPedapvoBMN

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 agent402-tools-image-generation-ee55d9f9 -d '<json body>'
```

Example prompt: Generate an image of a cozy Japanese tea house surrounded by cherry blossoms at dusk, with soft lantern light — pay per image in USDC via x402 with no API key.

## When to prefer this

Choose this endpoint when you need OpenAI SDK-compatible image generation, want to pay per image in USDC with no signup or API key, or are building an agent that uses x402 micropayment infrastructure. Prefer over OpenAI DALL-E or Stability AI when avoiding API key management or when the underlying Gemini 2.5 Flash Image model is preferred.

## Known failure modes

- Prompt too long — exceeds 4,000 character limit, returns validation error
- Payment failure — insufficient USDC balance or x402 handshake failure results in 402 Payment Required
- Content policy violation — prompt rejected for unsafe or policy-violating content
- Model unavailability — Gemini 2.5 Flash Image backend down, returns 503
- Malformed request body — missing required 'prompt' field returns 400

## How this service works

OpenAI-compatible image generation over x402 - point any OpenAI SDK's images.generate() at base_url https://agent402.tools/v1 and pay $0.08 per image in USDC, no API key, no signup. Served by Gemini 2.5 Flash Image (nano banana); prompt in (up to 4k chars), inline base64 image out (response_format b64_json). One image per call (n locked to 1). Optional zdr:true routes only to zero-data-retention providers.

## Output

Returns an image (URL or base64-encoded data) generated from the provided text prompt, consistent with the OpenAI images.generate() response format. Each call costs $0.08 USDC charged via the x402 payment protocol.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "zdr": {
   "type": "boolean",
   "description": "Optional - true routes only to zero-data-retention providers"
  },
  "prompt": {
   "type": "string",
   "description": "Text description of the image to generate (up to 4,000 chars)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": [
   {
    "b64_json": "iVBORw0KGgoAAAANSUhEUgAA…",
    "media_type": "image/png"
   }
  ],
  "model": "google/gemini-2.5-flash-image",
  "usage": {
   "total_tokens": 1304,
   "prompt_tokens": 14,
   "completion_tokens": 1290
  },
  "created": 1750000000
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-image-generation-ee55d9f9/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
