{"uid":"cap_IU_g9G4q_4QPnKIjUI7OZ","slug":"brotli-compress-agent402-tools-3e240ae2","name":"Brotli Compress (agent402.tools)","description":"Compress a string with Brotli (RFC 7932) and return it as base64. Brotli typically beats gzip by 15-25% on text - useful when bytes matter (e.g. cramming context into an LLM prompt, fitting under a transport cap). Slower than gzip; pick gzip if speed matters more than ratio.","url":"https://agent402.tools/api/brotli-compress","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"input":{"type":"string","description":"Content to compress (max 10MB after decoding)"},"quality":{"type":"number","description":"Brotli quality 0-11 (default 11 = best ratio, slowest)"},"inputFormat":{"type":"string","description":"How `input` is encoded: utf8 (default), base64, or hex"}}},"responseSchema":{"type":"json","example":{"ratio":0.6341,"output":"GygAAAB…","algorithm":"brotli","inputBytes":41,"outputBytes":15}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_He_ghZPpgnq6RvRS-1SU7","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Compresses a string using Brotli (RFC 7932) and returns the result as a base64-encoded string, with configurable quality level and input encoding.","exampleAgentPrompt":"Can you Brotli-compress this JSON string for me at quality level 11 so I can fit it into a prompt without hitting the token limit? The string is: '{\"key\":\"value\",\"items\":[1,2,3]}' — treat it as UTF-8 and give me back the base64 result.","exampleUseCases":null,"resultDescription":"Returns a base64-encoded string representing the Brotli-compressed version of the input, typically 15-25% smaller than gzip-equivalent output for text inputs.","failureModes":["Input exceeds 10MB limit after decoding — returns a size error","Invalid inputFormat value (not utf8, base64, or hex) — returns a validation error","Quality value outside 0-11 range — returns a parameter error","Malformed base64 or hex input when inputFormat is set accordingly — returns a decoding error","Payment not received or x402 handshake fails — returns 402 Payment Required"],"whenToPreferThis":"Choose this endpoint when byte count matters critically — e.g. cramming context into an LLM prompt, fitting data under a transport size cap, or achieving maximum compression ratio on text. Prefer over gzip when ratio matters more than speed. Use gzip-based alternatives when latency is the priority.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T00:30:02.117Z","isFirstParty":false}