v1 API is Live

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.

bash
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

01

Monitor Context

Your app detects when conversation history hits a threshold (e.g., 80% of context window).

02

Create Source

POST /v1/spaces/:spaceId/sources with type CONTENT. Ctxfy processes and compresses asynchronously.

03

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 content

Router 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 handoff

Cheaper than raw tokens.

Processing 1M tokens via Ctxfy is 5x cheaper than feeding them into GPT-4 repeatedly.

GPT-4 Input
$5.00 / 1M tokens
Ctxfy API
$0.50 / 1M tokens

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.

4.9/5 Developer Experience Rating