Quickstart

Three steps. Same SDK you already use.

How a request actually flows

CompresLM is a proxy that sits between your app and your LLM provider. Nothing changes about how you write prompts or read responses — only two things move: your CompresLM token (identifies you) and your provider key (used once per request, never saved).

1

Your app

Calls CompresLM's URL instead of OpenAI/Anthropic directly. Sends your CompresLM token + your provider key in headers.

2

CompresLM

Authenticates your token, compresses the message content that doesn't affect the answer, drops your provider key from any log.

3

Your LLM provider

Receives the compressed request, billed on your own account with your key. Returns its normal response.

4

Back to your app

CompresLM relays the provider's response unchanged — same JSON shape, same choices[0].message.content.

We never store your prompts, completions, or provider key. We only record token counts (before/after compression) so your dashboard and bill are accurate — see Privacy Policy.

1. Create an account & token

Sign up at /app, verify your email, then click Generate token. Copy it once — it is shown only at creation time. This token goes in the Authorization header on every request; it identifies your account, not your LLM provider.

2. Point your client at CompresLM

Change two things in your existing OpenAI-compatible client: the base URL (point it at CompresLM) and add one extra header carrying your own provider key. Everything else — model names you're used to, message format, streaming, tool calls — stays the same.

HeaderRequiredValue
Authorization Required Bearer YOUR_COMPRESLM_TOKEN — identifies your CompresLM account.
X-LLM-API-Key Required Your OpenAI / Anthropic / provider key. Used for this one request only, then discarded — never written to disk or logs.
X-LLM-API-Base Optional Only for a self-hosted / local model (vLLM, Ollama, etc.) — the URL of your own inference server.

Python

from openai import OpenAI

client = OpenAI(
    base_url="https://compreslm.com/v1",
    api_key="YOUR_COMPRESLM_TOKEN",
    default_headers={"X-LLM-API-Key": "YOUR_PROVIDER_KEY"},
)

resp = client.chat.completions.create(
    model="gpt-4o-mini-smart",
    messages=[{"role": "user", "content": "Summarize nothing — just say hi."}],
)
print(resp.choices[0].message.content)

cURL

curl https://compreslm.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_COMPRESLM_TOKEN" \
  -H "X-LLM-API-Key: YOUR_PROVIDER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini-smart",
    "messages": [{"role":"user","content":"Hello"}]
  }'

JavaScript

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://compreslm.com/v1",
  apiKey: "YOUR_COMPRESLM_TOKEN",
  defaultHeaders: { "X-LLM-API-Key": "YOUR_PROVIDER_KEY" },
});

const r = await client.chat.completions.create({
  model: "gpt-4o-mini-smart",
  messages: [{ role: "user", content: "Hello" }],
});

What you get back

An unmodified, standard chat-completion response from your provider — same fields you already parse today (choices, usage, etc.). CompresLM does not rewrite, summarize, or filter the model's answer. It only ever edits the input before it reaches the model.

3. Pick a model alias

The alias you call is what selects the compression strategy — the underlying model (GPT-4o, Claude Sonnet, etc.) is unaffected either way.

gpt-4o-mini-smart / gpt-4o-smart / claude-sonnet-smart (recommended) — one alias per model family. A cheap classification step reads each request and picks the safest compression strategy for that specific input; it never removes content it isn't confident is redundant.

*-raw (e.g. gpt-4o-mini-raw) — no compression at all, sent through byte-for-byte. Useful for debugging or A/B-checking output quality.

Common errors

StatusErrorMeaning
401 missing_provider_key The X-LLM-API-Key header was not sent.
402 free_tier_exhausted Your account passed the 1M free tokens. Response includes an upgrade_url. See billing.
401 / 403 (from your provider) Your provider key itself was rejected upstream — check it directly with OpenAI/Anthropic first.

Self-hosted / local LLM

Pass your upstream base URL with X-LLM-API-Base. Billing for local models uses a flat $0.50 per 1M tokens saved — see How billing works.

default_headers={
  "X-LLM-API-Key": "YOUR_LOCAL_KEY_OR_PLACEHOLDER",
  "X-LLM-API-Base": "http://your-vllm:8000/v1",
}

Advanced

CompresLM is OpenAI-compatible. The raw OpenAPI schema for the full proxy lives at /openapi.json. You usually do not need it — chat completions cover almost everything.

Need on-prem or a custom compression profile? Contact us — we help set it up for free.