# agent402.tools Gzip Compress

> agent402.tools Gzip Compress is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Compresses a string using gzip (RFC 1952) and returns the result as base64, along with input/output byte counts and compression ratio.

## Facts

- Endpoint: POST https://agent402.tools/api/gzip
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-gzip-compress-cb91af63
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-vd5oHa9rtEEkZAHxYA_i

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-gzip-compress-cb91af63 -d '<json body>'
```

Example prompt: Can you gzip-compress this JSON string at compression level 9 and give me the base64 output along with how much it shrank: '{"userId":"abc123","events":["login","purchase","logout"],"timestamp":"2024-01-15T10:30:00Z"}'?

## When to prefer this

Use this endpoint when you need to gzip-compress arbitrary text or binary content (provided as utf8, base64, or hex) and receive a base64-encoded result suitable for embedding in JSON, along with compression statistics. Prefer this over client-side compression when the agent runtime lacks native gzip support or when you need the compression ratio metric to decide whether compression is worth applying.

## Known failure modes

- Input exceeds 10MB limit after decoding — returns error
- Invalid inputFormat value (not utf8, base64, or hex) — returns validation error
- Compression level outside 1-9 range — returns validation error
- Malformed base64 or hex input when inputFormat is base64 or hex — decode error
- Payment not provided or insufficient — 402 Payment Required

## How this service works

Compress a string with gzip (RFC 1952) and return it as base64. Reports input bytes, output bytes, and the compression ratio so you can decide if it was worth doing. Input can be plain text (utf8) or already-binary content (base64 or hex).

## Output

Returns the gzip-compressed content encoded as base64, along with the original input byte size, the compressed output byte size, and the compression ratio — so the caller can evaluate whether compression was worthwhile.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "input": {
   "type": "string",
   "description": "Content to compress (max 10MB after decoding)"
  },
  "level": {
   "type": "number",
   "description": "Compression level 1-9 (default 9 = best ratio, slower)"
  },
  "inputFormat": {
   "type": "string",
   "description": "How `input` is encoded: utf8 (default), base64, or hex"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ratio": 0.4878,
  "output": "H4sIAA…",
  "algorithm": "gzip",
  "inputBytes": 41,
  "outputBytes": 21
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-gzip-compress-cb91af63/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)
