The Context Compression API
Don't let token limits crash your agents. Add a simple REST endpoint to your LLM pipeline to turn massive chat logs into concise, structured state objects.
curl -X POST https://api.ctxfy.com/v1/spaces/{spaceId}/sources \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"type":"CONTENT","initial_data":{"data":"..."}}'// Source created → receive postback with processed result
{
"data": {
"content": "Compressed state summary...",
"status": "COMPLETED"
}
}95% Token Reduction
Turn 20k tokens of fluff into 500 tokens of dense state.
Sub-200ms Latency
Optimized for real-time agent loops and chatbots.
Model Agnostic
Output works with OpenAI, Anthropic, Mistral, and Llama.
Drop-in Middleware for Your Stack
Monitor Context
Your app detects when conversation history hits a threshold (e.g., 80% of context window).
Create Source
POST /v1/spaces/:spaceId/sources with type CONTENT. Ctxfy processes and compresses asynchronously.
Use Compressed Output
Receive a postback with the processed source. Use the returned content as dense context.
Production Patterns
Infinite Agent Loops
Autonomous agents often crash after long execution runs. Use Ctxfy to periodically 'checkpoint' their memory, allowing them to run indefinitely without hitting context overflows.
// Create source with CONTENT; receive postback with processed data
const res = await fetch(`/v1/spaces/${spaceId}/sources`, {
method: "POST",
headers: { "Authorization": "Bearer " + apiKey, "Content-Type": "application/json" },
body: JSON.stringify({ type: "CONTENT", initial_data: { data: history }, instructions: {} })
});
// Wait for webhook/postback with the processed source contentRouter Architecture (Low-Cost Handoff)
Use a cheap model (e.g., Haiku) to handle chit-chat. When a complex task appears, compress the context and pass only the 'State Object' to GPT-4. Save money by not forwarding the raw transcript.
// Create source, receive postback with processed content
const res = await fetch(`/v1/spaces/${spaceId}/sources`, {
method: "POST",
body: JSON.stringify({ type: "CONTENT", initial_data: { data: haikuHistory }, instructions: {} })
});
// Use source content from postback as prompt for handoffExplore by use case
Cheaper than raw tokens.
Processing 1M tokens via Ctxfy is 5x cheaper than feeding them into GPT-4 repeatedly.
Related features
Resume in 30 Seconds
Your job: get back to productive work. Ctxfy turns 2 hours of re-reading into one paste. Load the minimal state you need—no full history. Works with ChatGPT, Claude, Gemini, and any AI tool.
Find Any Code or Decision
Your job: reuse what you already created. Stop losing 15 minutes scrolling. Ctxfy extracts code, schemas, and decisions—searchable when you need them.
Maintain Consistency
Keep AI aligned with your architectural rules and constraints across long projects
Frequently asked questions
We are SOC2 compliant. Data sent to the API is processed in memory and discarded immediately after the response is generated. We do not train on your API data.
You receive a Source object via postback with `data.content` (compressed/summarized text) when processing completes. Use GET /v1/spaces/:spaceId/artifacts for extracted code/schemas.
Yes. Enterprise plans include a Docker container for on-premise deployment to keep data within your VPC.
Yes. The API is REST-based. Use POST /v1/spaces/:spaceId/sources with type CONTENT to send conversations. See the documentation for integration examples.
Build smarter, cheaper agents.
Get your API key and start compressing in 5 minutes.
