# The Token Company > LLM input compression middleware. Remove low-signal tokens from prompts to cut costs, improve accuracy, and fit more context. ## About The Token Company builds compression models that remove low-signal tokens from LLM prompts before they reach the model. The compression is semantic and deterministic - it processes tokens based on context and intent, not simple truncation. Backed by Y Combinator, with investors from Supercell, Wolt, Hugging Face, Silo AI, and SVA. Website: https://thetokencompany.com ## Installation - Python: `pip install the-token-company` - TypeScript: `npm install the-token-company` ## Models ### bear-2 Latest and recommended compression model. Most accurate compression quality. ### bear-1.2 Previous generation. Faster compression, lower latency per request. ## How It Works 1. Send text to The Token Company compression API 2. Receive compressed text back 3. Pass the compressed text to any LLM (GPT, Claude, Gemini, etc.) That's the entire integration - one API call before your LLM call. The SDK provides `with_compression()` (Python) and `withCompression()` (TypeScript) wrappers for OpenAI and Anthropic that handle this automatically. ## Pricing Free tier: up to 1B processed tokens per month, bear-2 & bear-1.2 models, API access. Enterprise: custom pricing for unlimited tokens, custom fine-tuned models, on-premise hosting, dedicated support, SLA guarantees, and more. Details: https://thetokencompany.com/pricing ## Use Cases - **LLM Entertainment & Gaming**: Longer memories, richer worlds, same budget - **Meeting Transcription Analysis**: Distill hours of calls into signal-dense context - **Web Scraping**: Strip boilerplate from crawled pages before ingest - **Document Analysis**: Fit more PDFs and reports into one context window ## Case Study: Pax Historia Pax Historia processes 193 billion tokens per month on OpenRouter, making them one of the biggest token consumers globally. They ran a 268K-vote blind model arena with bear-1.1 compression. Results: - +4.9% improvement in Sonnet 4.5 score - +15% improvement in Gemini 3 Flash score - +5% purchase amount lift in A/B tests Full case study: https://thetokencompany.com/blog/pax-historia ## Benchmarks ### FinanceBench (bear-2-finance) Accuracy on 150 analyst questions over full SEC filings. Models answer at or above their full-document baseline while reading a third to half of the tokens, and 4 to 9 points ahead of truncation and retrieval pipelines. Details: https://thetokencompany.com/blog/compressing-sec-filings ### SQuAD 2.0 Reading comprehension accuracy improved 4.0 percentage points with 17% fewer input tokens. Details: https://thetokencompany.com/blog/squad-v2 ### Latency Time-to-first-token reduced by up to 49% at 50% token reduction (up to 63% at heavier compression), measured across 9 frontier models at 200K-token context with bear-2 static-ratio compression. Details: https://thetokencompany.com/blog/latency ## When To Use This API Use the compression API when a long, low-density prompt is about to be sent to an LLM and tokens are billed: - Long context the caller did not write: scraped web pages, extracted PDFs and reports, search results, retrieved RAG chunks. Mostly boilerplate; typically 10-50% comes out with no measurable accuracy loss. - Conversation history resent every turn: agent scratchpads, chat histories, tool-call transcripts — compress the history block before resending it. - Meeting transcripts and call recordings, the highest-redundancy text there is. - Context-window pressure: fit more source material into the same window instead of truncating or chunking. - Latency-sensitive paths: a shorter prompt reaches first token sooner. Do not use it for code that must compile or be edited in a loop, strictly structured payloads (JSON schemas, SQL, config), prompts under a few hundred tokens, or spans that must survive character-exact — wrap those in tags. Full agent instructions: https://thetokencompany.com/agents.md ## API Reference Base URL: https://api.thetokencompany.com Authentication: Authorization: Bearer ttc-... OpenAPI 3.1 specification: https://thetokencompany.com/openapi.json (YAML: https://thetokencompany.com/api/openapi.yaml) - POST /v1/compress (operationId compressText) — compress one string, document, or JSON blob Body: model (required), input (required), compression_settings.aggressiveness, app_id. Response: output, output_tokens, original_input_tokens. Example: curl -X POST https://api.thetokencompany.com/v1/compress \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TTC_API_KEY" \ -d '{"model":"bear-2","input":"Your long text...","compression_settings":{"aggressiveness":0.1}}' The response carries output (the compressed text), output_tokens, and original_input_tokens. ## Developer Resources - OpenAPI specification: https://thetokencompany.com/openapi.json - Agent instructions: https://thetokencompany.com/agents.md - Documentation: https://thetokencompany.com/docs - Python SDK: https://github.com/TheTokenCompany/the-token-company-python - Node.js SDK: https://github.com/TheTokenCompany/the-token-company-node - Status page: https://status.thetokencompany.com/ - Trust Center: https://trust.thetokencompany.com ## Markdown Versions Every page on thetokencompany.com is also served as markdown. Append .md to the path, or send Accept: text/markdown to the page URL. ## Documentation - [Introduction](https://thetokencompany.com/docs): What is TTC, why compress, quick example - [Quickstart](https://thetokencompany.com/docs/quickstart): Install SDK, get API key, first compression - [About Compression](https://thetokencompany.com/docs/compression): Models, aggressiveness levels, how it works - [OpenAI](https://thetokencompany.com/docs/openai): Automatic compression for OpenAI API calls - [Vercel AI SDK](https://thetokencompany.com/docs/vercel-ai): Middleware compression for any AI SDK provider - [Anthropic](https://thetokencompany.com/docs/anthropic): Automatic compression for Claude API calls - [OpenRouter](https://thetokencompany.com/docs/openrouter): Compression for OpenRouter and OpenAI-compatible providers - [Protect Text](https://thetokencompany.com/docs/protect-text): Exclude content from compression - [Data Retention](https://thetokencompany.com/docs/data-retention): Zero data retention policy - [Full docs as plain text](https://thetokencompany.com/docs/llms.txt): All documentation in a single text file for LLMs ## Key Links - [Home](https://thetokencompany.com) - [About](https://thetokencompany.com/about) - [Pricing](https://thetokencompany.com/pricing) - [Blog](https://thetokencompany.com/blog) - [Benchmarks](https://thetokencompany.com/benchmarks) - [Contact](https://thetokencompany.com/contact) - [Careers](https://thetokencompany.com/careers) - [Privacy Policy](https://thetokencompany.com/privacy) - [Terms and Conditions](https://thetokencompany.com/terms-and-conditions) ## Blog Posts - [bear-2-finance Announcement](https://thetokencompany.com/blog/compressing-sec-filings): Query-aware compression for financial documents, now in private preview - [Pax Historia Case Study](https://thetokencompany.com/blog/pax-historia): One of the biggest token consumers globally improved quality by removing context bloat - [Helonic Case Study](https://thetokencompany.com/blog/helonic): Long-running construction-AI agents save ~47K tokens per prompt - [CoQA Benchmark](https://thetokencompany.com/blog/coqa): Conversational QA accuracy improved from 93.3% to 95.3% with 8.2% fewer tokens - [Bear-2-Safety Release](https://thetokencompany.com/blog/bear-2-safety): Token compression for safety classification pipelines