LatentGate cuts AI costs by compressing inputs locally

LatentGate cuts AI costs by compressing inputs locally

LatentGate is a Python tool that shrinks images, long text, , and documents on a local computer before sending a smaller package to an outside AI model. The local step runs through Ollama, and the smaller result can go to services such as OpenAI, Anthropic, Google, Groq, or an . The goal is to reduce the number of tokens sent to paid AI services.

Its example says a direct image request can use about 1,200 tokens, while the LatentGate flow sends about 200 tokens instead. Its benchmarks also show long text going from about 800 tokens to 120, a 10-turn conversation from about 2,500 to 350, and three documents for a question from about 3,000 to 450. For 10,000 image questions with gpt-4o-mini, it estimates falling from 12 million to 2 million and cost falling from $1.80 to $0.30.

It can run as an MCP server for tools such as , Cursor, Cline, Continue, and Zed, so those tools can compress images, long prompts, large chats, and document questions automatically. It also includes caching, model preloading, , and a video mode that calls the outside AI only when a scene changes.

Key points

  • LatentGate compresses images, text, , and documents locally before calling an outside AI model.
  • Ollama handles the , while OpenAI, Anthropic, Google, Groq, and compatible endpoints can handle the final AI call.
  • The image example drops from about 1,200 tokens to about 200 tokens.
  • It can connect to AI tools through an MCP server, including , Cursor, Cline, Continue, and Zed.
  • The large-scale example estimates 10,000 image questions falling from $1.80 to $0.30 in input cost.
Read original