# X-Router Text-to-Image Generation

> X-Router Text-to-Image Generation is a paid API for AI agents from api.x-router.ai, paid per call via x402, $0.005694/call, status unknown (last checked 2026-10-11, last successful call 2026-06-16).

Generates images from text prompts using configurable AI image models, returning CDN-hosted image URLs

## Facts

- Endpoint: POST https://api.x-router.ai/v1/images/generate?utm_source=zero.xyz
- Price: $0.005694/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Last successful call: 2026-06-16
- Success rate: 60% of calls made through Zero
- Rating: 4.0 / 5 from 1 review
- Activations on Zero: 9
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-x-router-ai-b0052140
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_VwP-CEgq6ClWaMM6C0lSd

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-x-router-ai-b0052140 -d '<json body>'
```

Example prompt: Generate a photorealistic image of a serene mountain landscape with snow-capped peaks and a calm alpine lake — make it 1024x1024 pixels, use 30 inference steps, a guidance scale of 7.5, and set seed 42 so it's reproducible.

## When to prefer this

Choose this endpoint when you need to generate images from text descriptions via an x402-payment-gated API on the Base network, especially when you want fine-grained control over inference steps, guidance scale, image dimensions, and seed reproducibility. Prefer this over other text-to-image APIs when operating in a crypto-native payment context or when you need CDN-hosted output URLs with unique identifiers per image.

## Known failure modes

- Missing X-PAYMENT header returns 402 with payment instructions and accepted asset details
- Invalid prompt length (below 2 or above 3000 chars) causes validation error
- Width or height not divisible by 64 or outside 128-2048 range causes rejection
- Steps outside 1-50 range or numberResults outside 1-4 range causes parameter error
- Guidance scale outside 1-30 range returns validation error
- Unsupported model name causes model-not-found error
- Payment insufficient or on wrong network causes payment rejection

## How this service works

Text-to-Image Generation

## Output

Returns an array of generated image objects, each containing a CDN URL to the image and a unique UUID identifier, along with the model name used for generation.

## Example request

```json
{
 "seed": 42,
 "steps": 30,
 "width": 1024,
 "height": 1024,
 "prompt": "A serene mountain landscape with snow-capped peaks and a calm alpine lake at sunset, photorealistic style",
 "guidance": 7.5,
 "numberResults": 1
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "prompt"
 ],
 "properties": {
  "seed": {
   "type": "number",
   "description": "Random seed for reproducibility"
  },
  "model": {
   "type": "string",
   "description": "Image model to use"
  },
  "steps": {
   "type": "number",
   "description": "Number of inference steps (1-50)"
  },
  "width": {
   "type": "number",
   "description": "Image width in pixels, must be divisible by 64 (128-2048, default: 1024)"
  },
  "height": {
   "type": "number",
   "description": "Image height in pixels, must be divisible by 64 (128-2048, default: 1024)"
  },
  "prompt": {
   "type": "string",
   "description": "Text description of the image to generate (2-3000 chars)"
  },
  "guidance": {
   "type": "number",
   "description": "Guidance scale for generation (1-30)"
  },
  "numberResults": {
   "type": "number",
   "description": "Number of images to generate (1-4, default: 1)"
  },
  "negativePrompt": {
   "type": "string",
   "description": "Negative prompt to avoid certain elements (max 3000 chars)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "model": {
  "type": "string",
  "description": "Model used for generation"
 },
 "images": {
  "type": "array",
  "items": {
   "type": "object",
   "properties": {
    "url": {
     "type": "string",
     "description": "CDN URL of the generated image"
    },
    "uuid": {
     "type": "string",
     "description": "Unique identifier for the image"
    }
   }
  },
  "description": "Array of generated image objects"
 }
}
```

## More

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