Python client, SDK middleware, and framework integrations for ferrocache — a distributed semantic cache for LLM applications
Project description
ferrocache
Python client, SDK middleware, and framework integrations for ferrocache — a distributed semantic cache for LLM applications written in Rust.
Install
pip install ferrocache # base client (zero deps)
pip install ferrocache[openai] # + OpenAI middleware
pip install ferrocache[anthropic] # + Anthropic middleware
pip install ferrocache[langchain] # + LangChain cache backend
pip install ferrocache[llamaindex] # + LlamaIndex LLM wrapper
pip install ferrocache[mcp] # + MCP server for Claude Desktop
pip install ferrocache[all] # everything
Quick start
from ferrocache import FerrocacheClient
client = FerrocacheClient("http://localhost:3000")
client.insert(embedding=[0.1, 0.2, 0.3], response="cached answer", query_text="my query")
hit = client.query(embedding=[0.1, 0.2, 0.3], threshold=0.92)
SDK middleware (one-line integration)
from openai import OpenAI
from ferrocache.middleware import wrap_openai
client = wrap_openai(OpenAI()) # all chat completions now check cache first
from anthropic import Anthropic
from ferrocache.middleware import wrap_anthropic
client = wrap_anthropic(Anthropic())
Framework integration
# LangChain
from langchain.globals import set_llm_cache
from ferrocache.langchain import FerrocacheCache
set_llm_cache(FerrocacheCache())
# LlamaIndex
from llama_index.llms.openai import OpenAI
from ferrocache.llamaindex import FerrocacheLLM
llm = FerrocacheLLM(inner=OpenAI(model="gpt-4o-mini"))
MCP server (Claude Desktop / Claude Code)
pip install ferrocache[mcp]
python3 -m ferrocache.mcp_server
Three tools — semantic_cache_lookup, semantic_cache_store, cache_status — accept text and embed locally before talking to the cache. See the setup guide for Claude Desktop / Claude Code config.
Configuration
| Env var | Default | Used by |
|---|---|---|
FERROCACHE_URL |
http://localhost:3000 |
middleware, frameworks |
FERROCACHE_THRESHOLD |
0.92 |
middleware, frameworks |
FERROCACHE_EMBED_MODEL |
all-MiniLM-L6-v2 |
MCP server |
All wrappers default to fail_open=True — a cache outage falls through to the real call rather than crashing.
See the main repo for the Rust server, benchmarks, and full architecture docs.
Project details
Release history Release notifications | RSS feed
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 ferrocache-1.0.0.tar.gz.
File metadata
- Download URL: ferrocache-1.0.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6796a324a3364d14a90ac744c9477fe4778ba7e19e500e69d4ea6e79ecf2e8a2
|
|
| MD5 |
0a4f16934f10415004cb77507d801aba
|
|
| BLAKE2b-256 |
eb7e2b3196fdcde5cda7f47cdc844ba502f98b81f931639d61ea246730d1fd58
|
Provenance
The following attestation bundles were made for ferrocache-1.0.0.tar.gz:
Publisher:
release.yml on nickleodoen/ferrocache
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ferrocache-1.0.0.tar.gz -
Subject digest:
6796a324a3364d14a90ac744c9477fe4778ba7e19e500e69d4ea6e79ecf2e8a2 - Sigstore transparency entry: 1455595014
- Sigstore integration time:
-
Permalink:
nickleodoen/ferrocache@662854c4ce05c5c94fe01900343d264ffa574236 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/nickleodoen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@662854c4ce05c5c94fe01900343d264ffa574236 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ferrocache-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ferrocache-1.0.0-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ee64951eaa03c9f68e4f63d28e309a80f57029411012ce9781629b1dc18ce88
|
|
| MD5 |
490e7c0b18e4bc354dda534d24de8a88
|
|
| BLAKE2b-256 |
41a8b829bb5940ca071935eba7f44038bd95d5d8e27e4d0ff22c6e91a071a732
|
Provenance
The following attestation bundles were made for ferrocache-1.0.0-py3-none-any.whl:
Publisher:
release.yml on nickleodoen/ferrocache
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ferrocache-1.0.0-py3-none-any.whl -
Subject digest:
6ee64951eaa03c9f68e4f63d28e309a80f57029411012ce9781629b1dc18ce88 - Sigstore transparency entry: 1455595090
- Sigstore integration time:
-
Permalink:
nickleodoen/ferrocache@662854c4ce05c5c94fe01900343d264ffa574236 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/nickleodoen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@662854c4ce05c5c94fe01900343d264ffa574236 -
Trigger Event:
push
-
Statement type: