Lightweight caching library for AI/LLM API responses
Project description
AI CacheKit
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,get_or_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.cache import AIResponseCache
cache = AIResponseCache(ttl=3600) # Cache for 1 hour
def call_ai():
# Example: call your AI API here
return "Dragon story result"
prompt = "Write a short story about a dragon"
result = cache.get_or_set(prompt, call_ai)
print(result)
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
License
MIT License – free to use and modify.
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 ai_cachekit-0.1.0.tar.gz.
File metadata
- Download URL: ai_cachekit-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d22ab79f80d8c3906ebbb7314bb59d87642926ccd5c87c16497f34e80ba62e2
|
|
| MD5 |
6c92d4d0e33865d686cea0372d6f0539
|
|
| BLAKE2b-256 |
f3f9438bc5f46d5f62ab61266d581fef594d5baa69ee390d9f35420d4de4beeb
|
File details
Details for the file ai_cachekit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ai_cachekit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ee8eda60b689dfee8c7046046b8bfefbe636ed3f9a30ab363f21f843e3a5d18
|
|
| MD5 |
2e2c76a5c303ff0e1349c7510b29570e
|
|
| BLAKE2b-256 |
6e3e3bae74a2d1fee1fbfd95e8a970f27f5cde19ef22315b877b295244efd0e9
|