# Context Compression API

> Context Compression API is a paid API for AI agents from context-compression-api.johntaylor1online.workers.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-15).

Compresses text using AI saliency scoring to reduce token count while preserving semantic meaning

## Facts

- Endpoint: POST https://context-compression-api.johntaylor1online.workers.dev/compress
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/context-compression-api-e2f1983b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_WhfHR6FZxJVnaeSQVfwEm

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 context-compression-api-e2f1983b -d '<json body>'
```

Example prompt: Compress this long document so it fits in a smaller context window — I need to reduce the token count but keep the most important information intact: [paste text here].

## When to prefer this

Choose this endpoint when you need to reduce token count of text before sending it to an LLM, fitting content within a context window, or cutting API costs — especially when a simple truncation would lose important meaning and you want AI-guided saliency-based selection of what to keep.

## Known failure modes

- Empty or missing input text returns a validation error
- Text already below minimum length may not compress meaningfully
- Payment failure via x402 protocol results in 402 Payment Required response
- Very short inputs may return near-identical output with minimal compression
- Rate limiting or worker timeout on extremely large inputs

## How this service works

Compress text using AI saliency scoring — reduces tokens while preserving meaning

## Output

Returns a compressed version of the input text with reduced token count, where AI saliency scoring has identified and retained the most semantically important content while discarding lower-priority tokens.

## Request schema (JSON Schema)

```json
{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input",
  "output"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "body": {},
     "enum": [
      "POST"
     ],
     "type": "string",
     "bodyType": "json"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/context-compression-api-e2f1983b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from context-compression-api.johntaylor1online.workers.dev](https://www.zero.xyz/host/context-compression-api.johntaylor1online.workers.dev/llms.txt)
