https://api.radril.com/v1
Docs
Compact context with an API key.
The current hosted endpoint accepts a query and context, then returns the smaller context plus a receipt.
Authorization: Bearer RADRIL_API_KEY
Request
POST /compact
{
"query": "Find the three renewal risks.",
"context": "Long text, markdown, transcript, or retrieved chunks.",
"target_ratio": 0.10,
"format": "markdown"
}
Response
Receipt included.
{
"id": "cmp_7XQ9",
"compacted_context": "Renewal risk summary...",
"input_tokens": 112000,
"output_tokens": 9600,
"compression_ratio": 11.7,
"estimated_savings_pct": 78
}
Python
Drop in before your model call.
import os
import requests
response = requests.post(
"https://api.radril.com/v1/compact",
headers={"Authorization": f"Bearer {os.environ['RADRIL_API_KEY']}"},
json={
"query": "What changed in Q4 revenue?",
"context": open("report.md", encoding="utf-8").read(),
"target_ratio": 0.10,
},
timeout=60,
)
compact = response.json()["compacted_context"]
Errors
Small surface area.
| Code | Meaning |
|---|---|
| 401 | Missing or invalid API key. |
| 413 | Context is over the account limit. |
| 429 | Rate limit reached. |
| 500 | Retry with backoff. |