Skip to main content

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.

Metadata

Release files for ferrocache 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ferrocache 1.0.0
File Size Uploaded
ferrocache-1.0.0.tar.gz 15.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ferrocache 1.0.0
File Interpreter ABI Platform
ferrocache-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.4 kB

Release files / ferrocache-1.0.0.tar.gz

Download URL ferrocache-1.0.0.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6796a324a3364d14a90ac744c9477fe4778ba7e19e500e69d4ea6e79ecf2e8a2
BLAKE2b-256 checksum
How to use checksums
eb7e2b3196fdcde5cda7f47cdc844ba502f98b81f931639d61ea246730d1fd58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Release files / ferrocache-1.0.0-py3-none-any.whl

Download URL ferrocache-1.0.0-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ee64951eaa03c9f68e4f63d28e309a80f57029411012ce9781629b1dc18ce88
BLAKE2b-256 checksum
How to use checksums
41a8b829bb5940ca071935eba7f44038bd95d5d8e27e4d0ff22c6e91a071a732
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page