LatentGate

•
25
•

Compress logs, JSON, documents, and web pages offline and deterministically to reduce LLM token consumption and API costs.

LatentGate is a local-first token optimization pipeline and MCP server designed to strip noise from logs, structured data, documents, and conversation histories before sending them to large language models. Operating deterministically in milliseconds without external API keys, it preserves critical facts, code blocks, and URLs byte-for-byte while achieving up to 66% token reduction on mixed development corpora and over 90% on repetitive error logs. With seamless integration for Claude Code, Cursor, Zed, and other AI agents, LatentGate enables developers to work with massive files without blowing through context windows or incurring heavy API costs.

Key Features

01Preserves code blocks, quoted strings, and URLs byte-for-byte without fact loss
02Local multi-modal preprocessing using Ollama for image summarization and selective video decoding
03Versatile interfaces including a Python API, CLI, and FastAPI REST server with streaming and async support
04Deterministic offline text and log optimization delivering up to 90%+ token savings
05Native Model Context Protocol (MCP) tools for Claude Code, Cursor, Cline, and Zed
0625 GitHub stars

Use Cases

01Feeding massive application logs and stack traces into AI assistants without exceeding context limits
02Compressing RAG retrieval documents and long conversation histories to lower cloud LLM API costs
03Preprocessing images and video frames locally before routing queries to commercial frontier models