81trust / 100

Compress Compare

by Compression compare in Other

x402 APIPassing, checked 2 h ago

Run the same input through gzip, brotli, and raw deflate at max settings and report each one's output size and ratio. Use this to decide which algorithm to actually use - the answer depends on your content (binary often resists compression entirely; English prose squeezes well with brotli; JSON sits in between).

POST https://agent402.tools/api/compress-compare

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
221 ms typical, 221 ms slowest 5%
Last check
2 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/api/compress-compare" \
  -H "content-type: application/json" \
  -d '{"input":"the quick brown fox jumps over the lazy dog the quick brown fox jumps over the lazy dog","inputFormat":"utf8"}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fapi%2Fcompress-compare
const res = await pay("https://agent402.tools/api/compress-compare", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"input":"the quick brown fox jumps over the lazy dog the quick brown fox jumps over the lazy dog","inputFormat":"utf8"}),
});
console.log(await res.json());

Example input

{
  "input": "the quick brown fox jumps over the lazy dog the quick brown fox jumps over the lazy dog",
  "inputFormat": "utf8"
}

Example output

{
  "best": "brotli",
  "inputBytes": 87,
  "results": [
    {
      "algorithm": "brotli",
      "outputBytes": 28,
      "ratio": 0.6782
    },
    {
      "algorithm": "gzip",
      "outputBytes": 41,
      "ratio": 0.5287
    },
    {
      "algorithm": "deflate",
      "outputBytes": 29,
      "ratio": 0.6667
    }
  ]
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
2 h agoPassed402221 ms$0.001
7 h agoPassed402290 ms$0.001