# Agent Image Compression API

> Agent Image Compression API is a paid API for AI agents from agent-image-compress-production.up.railway.app, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-13).

Compresses an uploaded image and returns a smaller WebP-format version with metadata about bytes saved, using pay-per-call x402 micropayment protocol.

## Facts

- Endpoint: POST https://agent-image-compress-production.up.railway.app/api/compress
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent-image-compression-api-2ece96ac
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_xHPEDryUhrYLnqLtnupFQ

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 agent-image-compression-api-2ece96ac -d '<json body>'
```

Example prompt: Can you compress this image for me to reduce its file size — it's a 100KB PNG and I want it as small as possible in WebP format?

## When to prefer this

Choose this endpoint when an AI agent needs to compress or convert a single image to WebP format on a pay-per-use basis without a subscription, especially in automated pipelines that use the x402 micropayment protocol. Ideal for agents that need to reduce image file size programmatically and receive back both the compressed image and compression metrics.

## Known failure modes

- Invalid or missing image data returns an error response
- Unsupported image format may cause processing failure
- Payment failure via x402 prevents the request from being fulfilled
- Oversized image payload may be rejected
- Network timeout on Railway-hosted service during high load

## How this service works

Pay-per-image compression for AI agents (x402 + MPP).

## Output

Returns a JSON object containing: the compressed image as a base64-encoded WebP string, the output width and height in pixels, the input and output file sizes in bytes, the content type (image/webp), and the percentage of file size saved (e.g. 62.7%).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "url": {
   "type": "string",
   "format": "uri",
   "description": "HTTPS URL of the source image to compress."
  },
  "format": {
   "enum": [
    "png",
    "jpeg",
    "webp",
    "avif"
   ],
   "type": "string",
   "description": "Target output format. Defaults to the input format."
  },
  "quality": {
   "type": "integer",
   "maximum": 100,
   "minimum": 1,
   "description": "Encoder quality 1-100. Defaults to 80."
  },
  "maxWidth": {
   "type": "integer",
   "maximum": 20000,
   "minimum": 1,
   "description": "Max output width in px. Never upscales."
  },
  "maxHeight": {
   "type": "integer",
   "maximum": 20000,
   "minimum": 1,
   "description": "Max output height in px. Never upscales."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "image": "UklGRk4AAABXRUJQVlA4IEIAAAAwAQCdASo...<base64>",
  "width": 1024,
  "format": "webp",
  "height": 768,
  "inputBytes": 102400,
  "contentType": "image/webp",
  "outputBytes": 38211,
  "percentSaved": 62.7
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent-image-compression-api-2ece96ac/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent-image-compress-production.up.railway.app](https://www.zero.xyz/host/agent-image-compress-production.up.railway.app/llms.txt)
