Coding & Development✨gemini🤖claude💬gpt⌨️cursor🌐universal
LatentGate
VL-JEPA inspired pipeline — compress images/text locally via Ollama, send compact payloads to any LLM API. Cut token costs by ~80%.
Quick Start
Install this Skill
npx skills add KathanModh259/latent-gate<div align="center"> # LatentGate ### *Process Locally. Send Smart. Pay Less.* **A VL-JEPA-inspired pipeline that compresses images, text, conversations, and RAG documents locally via Ollama, then sends only compact semantic payloads to any LLM API — cutting token costs by ~80%.** [](https://www.python.org/downloads/) [](LICENSE) [](CHANGELOG.md) [](CONTRIBUTING.md) [](https://ollama.com) [](https://modelcontextprotocol.io) [](tests/) [](https://codecov.io/gh/KathanModh259/latent-gate) [](https://pypi.org/project/latent-gate/) [](https://discord.gg/your-invite) [](https://awesome.re) [](https://www.producthunt.com/posts/latent-gate) [**Quick Start**](#quick-start) | [**Python API**](#python-api) | [**REST API**](#rest-api) | [**AI Tool Integrations**](#ai-coding-tool-integration-mcp) | [**Benchmarks**](#cost-benchmarks) | [**Contributing**](#contributing) | [**Community**](#community) </div> --- ## The Problem Every time you send an image or long prompt to GPT-4o / Claude / Gemini, you burn 1,000+ tokens on processing that could happen locally for free. ``` Traditional: Image -> Cloud LLM (1,200 tokens) -> Answer LatentGate: Image -> Local Ollama (FREE) -> Cloud LLM (200 tokens) -> Answer ``` --- ## Features | Feature | Description | |---------|-------------| | **Local-First** | Vision and text compression runs on Ollama (free, no API key needed) | | **~80% Token Savings** | Send ~200 tokens instead of ~1,200 for image queries | | **MCP Server** | Works with Claude Desktop, Cursor, Cline, Continue, Zed | | **Selective Decoding** | For video, only call API when scene changes (~2.85x fewer calls) with cosine similarity | | **Text Compression** | Long prompts, conversations, RAG docs compressed locally | | **Speed Optimized** | Connection pooling, model preloading, parallel processing | | **Multi-Provider** | OpenAI, Anthropic, Google, Groq, DeepSeek, Together, Azure, AWS Bedrock, Ollama, or any OpenAI-compatible endpoint | | **REST API** | FastAPI server for web application integration | | **Video Processing** | Direct video file input with automatic frame extraction | | **Cost Tracking** | Persistent cost tracking with SQLite analytics and exportable reports | | **Async Support** | Non-blocking async methods for FastAPI, aiohttp, etc. | | **Streaming Responses** | Stream responses from remote LLMs | | **Config Persistence** | YAML/TOML config files with environment variable overrides | | **Structured Logging** | JSON-formatted logging with rotation and correlation IDs | | **Docker Support** | Dockerfile and docker-compose for easy deployment | | **Plugin System** | Custom processors for domain-specific compression | | **Multi-Language** | Support for 30+ languages with automatic detection | --- ## Quick Start ### Install ```bash # Core install pip install latent-gate # With MCP server (for Claude Desktop, Cursor, Cline, etc.) pip install latent-gate[mcp] # With API server (for web applications) pip install latent-gate[api] # With video processing pip install latent-gate[video] # With embedding-based similarity (more accurate selective decoding) pip install latent-gate[embeddings] # With LangChain integration pip install latent-gate[langchain] # With AWS Bedrock support pip install latent-gate[bedrock] # With all features pip install latent-gate[all] ``` ### Pull Ollama Models ```bash ollama pull llava:7b # Vision model (required for image queries) ollama pull llama3:8b # Text model (required for text compression & prediction) ``` ### CLI Usage ```bash # Image query python -m latent_gate photo.jpg "What is in this image?" --provider ollama -v # Text compression python -m latent_gate --text "Your long prompt here..." --provider ollama -v # Text from file python -m latent_gate --text-file prompt.txt --provider openai -v # Image + Text combined python -m latent_gate photo.jpg "Analyze" --text "Extra context..." -v # Full JSON output python -m latent_gate photo.jpg "Describe" --json -v # Start API server (requires: pip install latent-gate[api]) latent-gate-api ``` --- ## Python API ### Image Query ```python from latent_gate import Laten ... (truncated)
Repository
20stars
0forks
Details
Related Skills
More coding & development skills you might like
Reticle
Coding & DevelopmentAI agents can generate code, but still struggle to understand what they build. Reticle brings Jev-style machine-native runtime perception to web & desktop applications.
🤖claude🌐universal
1.2k
190
View
agentscope-java
Coding & DevelopmentExpert Java developer skill for AgentScope Java framework - a reactive, message-driven multi-agent system built on Project Reactor. Use when working with reactive programming, LLM integration, agent orchestration, multi-agent systems, or when the user mentions AgentScope, ReActAgent, Mono/Flux, Project Reactor, or Java agent development. Specializes in non-blocking code, tool integration, hooks, pipelines, and production-ready agent applications.
🌐universal
6.0k
1.5k
View
ospec
Coding & DevelopmentDocument-driven OSpec workflow for initialization, change/goal routing, validation, archiving, and durable project knowledge.
✨gemini🤖claude💬gpt🌐universal
524
34
View
misakanet-failure-memory
Coding & Development📚 A zero-dependency, git-backed micro-lesson library for AI Agents to asynchronously share and search verified debugging experience. Python stdlib only. | https://misakanet.org
🤖claude⌨️cursor🌐universal
424
158
View