Skip to main content

AI CacheKit

Tests PyPI version License: MIT

Lightweight caching library for AI/LLM API responses.
Reduce costs and improve performance by storing API responses locally with hash-based keys and optional TTL.


Features

  • 🔹 Simple API: get, set
  • 🔹 Local JSON storage (no external DB required)
  • 🔹 Optional TTL (time-to-live) for cache expiration
  • 🔹 Perfect for OpenAI, Anthropic, Ollama, etc.

Installation

From GitHub (development version):

pip install git+https://github.com/EDLadder/ai-cachekit.git

From PyPI (after release):

pip install ai-cachekit

Usage

from ai_cachekit import AIResponseCache

cache = AIResponseCache(backend="memory")
cache.set("question", "answer")
print(cache.get("question"))

File-Based Cache (JSON)

cache = AIResponseCache(backend="file", filepath="my_cache.json")
cache.set("key", "value")
print(cache.get("key"))

Redis Cache

cache = AIResponseCache(backend="redis", host="localhost", port=6379)
cache.set("key", "value")
print(cache.get("key"))

Why?

  • Avoid repeated API calls (save cost & time)
  • Minimal dependencies and setup
  • Flexible for any AI API (OpenAI, LLaMA, etc.)

Development

Clone repo and install dev dependencies:

git clone https://github.com/EDLadder/ai-cachekit.git
cd ai-cachekit
pip install -r requirements.txt
pytest

Plans

  • Support for Redis and SQLite backends.
  • CLI tool for managing cache.
  • Built-in stats: hit rate, saved cost estimation.
  • Encryption for cached data.

License

MIT License – free to use and modify.

Metadata

Release files for ai-cachekit 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 ai-cachekit 1.0.0
File Size Uploaded Provenance
ai_cachekit-1.0.0.tar.gz 4.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 9.7 kB

Release files / ai_cachekit-1.0.0.tar.gz

Download URL ai_cachekit-1.0.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e07d8ca679fa9dbceeaa3d9477d3afafc36e36adc6f041121c03a6fadfe15dc9
BLAKE2b-256 checksum
How to use checksums
d9461f8710b1f44c1ece804cb5d7824174f1a6dd1629b3c772ed013bc0c3a0ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

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

Download URL ai_cachekit-1.0.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f27dcb6d1d9344bbb22ef57d5a48d77a8e40a3dd7e96a361be3030167c22b0c
BLAKE2b-256 checksum
How to use checksums
38c89e792474379a390e51c593af8468dd04015535b9398c8b6d0911dfc0c3e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Security for ai-cachekit 1.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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