Compress text to a token budget
compressReduce text to fit a token budget, preserving whole sentences and reporting before/after token estimates. Costs $0.010 in USDC on Base, paid via the x402 protocol, or from a credit token — call credits_trial for free credit if you have neither.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"text": "<text>"
},
"name": "compress"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Text to compress | |
| strategy | No | Compression strategy (default extractive) | |
| credit_token | No | Optional. A credit token from credits_trial or /credits/buy. Supplying it pays for this call from that balance, so no x402 payment or wallet is needed. | |
| target_tokens | No | Approximate token budget |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The compressed text | |
| ratio | Yes | compressed_length / original_length. Lower is more aggressive. | |
| strategy | No | Strategy applied, echoing your request | |
| original_length | Yes | Input length in characters | |
| compressed_length | Yes | Output length in characters |