# Image Format Conversion API

> Image Format Conversion API is a paid API for AI agents from api.bakhour.ca, paid per call via x402, $0.02/call, status unknown (last checked 2026-09-15).

Converts a public image URL to a specified format (JPG, PNG, or WebP) with configurable quality and maximum dimensions, returning base64-encoded image data.

## Facts

- Endpoint: POST https://api.bakhour.ca/media/image/convert
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/image-format-conversion-api-2054a01d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_rCworBZbRytGTK-2ETpE3

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 image-format-conversion-api-2054a01d -d '<json body>'
```

Example prompt: Convert this image to WebP format at quality 85 with a max width of 1280 pixels: https://example.com/photo.jpg

## When to prefer this

Use this endpoint when you need a deterministic, pay-per-use image format conversion from a public URL without setting up your own image processing pipeline. It is ideal for agent workflows that need to normalize image formats (especially to WebP for web delivery), resize images to bounded dimensions, and receive the result as base64 data inline — all in a single API call with transparent pricing.

## Known failure modes

- Source URL is not publicly accessible or uses HTTP redirects — request is rejected
- Source URL points to a private or non-image resource — returns error
- Requested dimensions exceed the 4096px maximum — validation error
- Quality value outside the 20–95 range — rejected with schema validation error
- Unsupported format requested (outside jpg/png/webp) — rejected
- Network timeout fetching the remote image URL

## How this service works

Decision-grade security/due-diligence outcome reports ($20-$100) plus deterministic paid utilities ($0.001+) for software agents and automated workflows.

## Output

A JSON object containing the base64-encoded converted image (data_base64), the output MIME type, output format name, file size in bytes, a SHA256 hash of the result, and an economics breakdown showing the API price, estimated local processing cost, and estimated gross profit.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "format": {
   "enum": [
    "jpg",
    "png",
    "webp"
   ],
   "type": "string",
   "default": "webp"
  },
  "quality": {
   "type": "integer",
   "default": 82,
   "maximum": 95,
   "minimum": 20
  },
  "max_width": {
   "type": "integer",
   "maximum": 4096,
   "minimum": 64
  },
  "max_height": {
   "type": "integer",
   "maximum": 4096,
   "minimum": 64
  },
  "source_url": {
   "type": "string",
   "description": "Public HTTPS image URL. Redirects and private destinations are rejected."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "bytes": 12345,
  "format": "webp",
  "sha256": "...",
  "economics": {
   "price_usd": 0.02,
   "estimated_local_cost_usd": 0.001,
   "estimated_gross_profit_usd": 0.019
  },
  "mime_type": "image/webp",
  "data_base64": "..."
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/image-format-conversion-api-2054a01d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.bakhour.ca](https://www.zero.xyz/host/api.bakhour.ca/llms.txt)
