OmniCache
OmniCache is a local acceleration sidecar for AI coding agents (Claude Code, Cursor, Aider, and custom LLM workflows).
It sits between your coding assistant and upstream LLM providers (Anthropic, OpenAI, Gemini) to eliminate redundant tool executions, stream terminal tokens smoothly, and share cached knowledge across developer sessions.
Why OmniCache?
How OmniCache Complements Native Anthropic Prompt Caching
Anthropic’s native prompt caching is great at discounting prefix tokens within a single active conversation. However, it structurally leaves two major gaps open in real-world coding agent loops:
┌───────────────────────────────────────────────┬───────────────────────────────┬─────────────────────────────────┐
│ Capability │ Native Provider Caching │ OmniCache Acceleration Sidecar │
├───────────────────────────────────────────────┼───────────────────────────────┼─────────────────────────────────┤
│ In-Session Prefix Input Token Discount │ ✅ 90% (Anthropic ephemeral) │ ✅ Supported (Passthrough) │
│ Redundant Disk Tool Replay (git/grep/read) │ ❌ No (Hits disk & LLM every turn) │ ✅ <0.3ms (Git-state hashed) │
│ Cross-Session Memory (New CLI sessions) │ ❌ 0% (Expires in 5 minutes) │ ✅ Persistent (SQLite / Redis) │
│ Cross-Teammate Knowledge Sharing │ ❌ 0% (Isolated per session) │ ✅ Shared Team Redis Store │
│ Terminal SSE Stream Jitter Replay │ ❌ No │ ✅ ~65 tok/s (Glitch-free CLI) │
│ Multi-Modal Visual Deduplication (Screenshots) │ ❌ No (Re-uploads megabytes) │ ✅ Perceptual dHash Match │
└───────────────────────────────────────────────┴───────────────────────────────┴─────────────────────────────────┘
- Tool-Call Acceleration: When Claude Code repeatedly calls
git_status,grep_search, orread_file, native caching still runs the tool on disk and pays for the network roundtrip. OmniCache cryptographically hashes your Git working tree state (HEADcommit +git status --porcelain). If files haven't changed, tool calls return in<0.3mswith $0.00 spent. The moment you edit a file, the cache instantly invalidates. - Persistent Cross-Session & Team Memory: Native prompt cache is ephemeral (5-minute TTL). OmniCache stores answers in an embedded SQLite WAL database or shared Redis, so opening a new session or having a teammate ask a similar architecture question reuses existing answers.
- Smooth CLI Stream Replaying: Returning a 4,000-token cached completion instantaneously in 0ms can cause buffer overflows and terminal glitches in interactive CLIs. OmniCache emulates natural token-streaming (~65 tokens/sec with subtle stochastic jitter).
Installation
Standard (PyPI)
pip install omnicache-proxy
Android & Edge (Termux 1-Line Setup)
curl -fsSL https://raw.githubusercontent.com/13manmayarai-hash/omnicache-proxy/main/scripts/install_termux.sh | bash
Docker & Redis Cluster
docker compose up -d
Zero-Config Quickstart (omnicache run)
The easiest way to use OmniCache is the zero-config run wrapper. It automatically launches the background proxy, injects provider environment variables (ANTHROPIC_BASE_URL, OPENAI_BASE_URL), and displays a session savings ledger when finished:
1. Launch Claude Code
omnicache run claude
2. Launch Cursor / VS Code / Other Agent Scripts
omnicache run cursor .
# or custom Python agent scripts:
omnicache run python my_coding_agent.py
When you exit your session, OmniCache outputs a clean summary:
╭──────────────────────────────────────────────────╮
│ ⚡ OmniCache Session Telemetry │
│ - Tokens Saved: 1,840 tokens │
│ - Avoided Cost: $ 0.0142 USD │
│ - Tool Replays: 14 cached tool calls │
╰──────────────────────────────────────────────────╯
Manual Quickstart
1. Start the Background Daemon
omnicache
By default, the proxy runs on http://127.0.0.1:8000.
2. Configure Your Client Manually
Claude Code (Terminal CLI)
export ANTHROPIC_BASE_URL="http://127.0.0.1:8000"
claude
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="your-api-key",
base_url="http://127.0.0.1:8000/v1"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "How do I configure CORS headers in FastAPI?"}]
)
print(response.choices[0].message.content)
Key Features
- Deterministic Git-Aware Tool Replay:
- Intercepts and caches idempotent agent tools (
git_status,git_diff,read_file,grep_search,list_dir). - Cryptographically fingerprinted against
git rev-parse HEADandgit status --porcelain. - Modifying files or changing branches instantly invalidates stale results with zero false positives.
- Intercepts and caches idempotent agent tools (
- Dual-Tier Cache Engine:
- L1 Exact Match (Trie Hash / Redis): Sub-0.05ms lookup for identical request payloads.
- L2 FastHash Semantic Match: In-memory 512-d hyperplane locality-sensitive hashing for syntactically varied queries without external vector DB dependencies.
- Stream Replayer with Terminal Jitter:
- Delivers cached SSE streams with natural human-like cadence (~65 tok/s) and
<10msTime-To-First-Token (TTFT) for seamless CLI rendering.
- Delivers cached SSE streams with natural human-like cadence (~65 tok/s) and
- Model Context Protocol (MCP) Remote Server:
- Native
/mcpJSON-RPC 2.0 endpoint allowing Claude Code, Cursor, and IDEs to discover and invokeomnicache_replay_toolandomnicache_record_tool.
- Native
- SingleFlight Request Coalescing:
- Deduplicates concurrent in-flight requests for identical prompts, forwarding only one upstream call.
- Horizontal Scaling with Redis:
- Connect to Redis (
REDIS_URL="redis://127.0.0.1:6379/0") for shared team memory and multi-worker clusters.
- Connect to Redis (
- Explainability Headers:
- Transparent
X-OmniCache-Decision(HIT|MISS),X-Tokens-Saved, andX-Cost-Avoided-USDresponse headers.
- Transparent
Built-in CLI Utilities
# Check database, port bindings, and vector engine health
omnicache doctor
# Run high-speed micro-benchmarks on your machine
omnicache benchmark
# Print cumulative token and USD savings
omnicache stats
Observability & Diagnostics
- Web Dashboard & Visualizer:
http://localhost:8000/dashboard(features real-time savings velocity timeline and resolution distribution charts powered by Chart.js) - Prometheus Metrics:
http://localhost:8000/metrics - Cache Statistics:
http://localhost:8000/v1/cache/stats - CSV Export:
http://localhost:8000/v1/cache/export
Documentation
License
MIT License. See LICENSE for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omnicache_proxy-2.8.0.tar.gz.
File metadata
- Download URL: omnicache_proxy-2.8.0.tar.gz
- Upload date:
- Size: 131.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f30c91f355f606af4f5ed9e292574bd1bb88bdd35993dcf633ecd0d82075584c
|
|
| MD5 |
d76c040232564f022cd2d4951bed760c
|
|
| BLAKE2b-256 |
780e401c5a9aca4cab1d7d22551806db5ff93a28bf71189dbfbf0a8cd58e090a
|
File details
Details for the file omnicache_proxy-2.8.0-py3-none-any.whl.
File metadata
- Download URL: omnicache_proxy-2.8.0-py3-none-any.whl
- Upload date:
- Size: 97.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5370bf3f3929f8d60d9887d7b9089429c173c7214fb87d00672339dbdd4138d
|
|
| MD5 |
ec54516b5c5529fd8f62a12d9019d65b
|
|
| BLAKE2b-256 |
90d15957839feabd150ba7ea3f9af122f4b79bb2d8a2bd56ddf2e05c563a687f
|