Curtly
Context Window Optimization

High-speed input prompt context compression

Strip redundant semantic tokens, whitespace bloat, and RAG document noise before payloads reach your frontier model endpoint.

Average Input Savings
50% - 68%

Measured across RAG context, agent tool calls, and developer prompts.

Throughput Speed
< 2ms

In-memory deterministic compression with zero external network hops.

AST Syntax Drift
0.00%

Bit-for-bit guarantees on all isolated code and structured blocks.

The production engineering challenge

Large RAG documents, multi-turn chat histories, and massive agent tool schemas consume tens of thousands of tokens per call. Due to BPE sub-token splitting, repetitive formatting characters and word structures inflate context windows and multiply API costs.

Technical architecture & mechanics

1

Sub-token whitespace and delimiter normalization

Normalizes repetitive spaces, indentations, and punctuation clusters that cause modern BPE tokenizers to generate fragmented sub-tokens.

2

Semantic entropy pruning

Identifies and eliminates low-information words and conversational filler from user and system instructions while retaining key entities and directives.

3

Safe Vault code isolation

Locks source code, JSON schemas, SQL queries, and variable placeholders bit-for-bit so they bypass text compression completely.

Direct Input Compression API

const res = await fetch('https://api.curtly.dev/v1/compress', { method: 'POST', headers: { 'Authorization': 'Bearer ' + process.env.CURTLY_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ prompt: verboseContextDocument, mode: 'balanced', // conservative | balanced | aggressive model: 'claude-fable-5-1', }), }); const { compressedPrompt, tokensSaved, savingsPercent } = await res.json();

Architecture comparison

Evaluation metricCurtly.dev gatewayTraditional / naive approach
Compression Speed< 2ms in-memory execution150-400ms via secondary LLM summarizers
Code & JSON SafetySafe Vault isolation ensures 0% corruptionFrequent truncation of quotes, brackets, and variables
Cost OverheadIncluded in lightweight flat planRequires paying for extra summarizer model tokens

Frequently asked questions

No. Curtly applies deterministic token normalization and entropy reduction that preserves semantic meaning, instruction priority, and structural constraints.

Ready to optimize your AI infrastructure?

Start optimizing in 60 seconds with a 1-line baseURL change. Free tier available with zero credit card required.