llm-caching
Skill by sickn33
Implements multi-layer LLM caching with exact match, semantic similarity, and provider-side prompt caching. Aimed at teams that want to cut repeated LLM API costs and latency.
Install llm-caching
Built from the published package, never by AI.
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills /tmp/agentic-awesome-skills && mkdir -p ~/.claude/skills && cp -r /tmp/agentic-awesome-skills/skills/llm-caching ~/.claude/skills/llm-cachingRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills /tmp/agentic-awesome-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/agentic-awesome-skills/skills/llm-caching ~/.gemini/antigravity-cli/skills/llm-cachingAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill explains how to cut LLM costs and latency by adding caching layers in front of an LLM API. It covers an exact match cache built on Redis, a semantic cache that matches similar queries using embeddings, and provider-side prompt caching for Anthropic and OpenAI. Requests pass through the layers in order, and a hit at any layer skips the LLM call.
The skill also covers a gateway-level semantic cache option, cache warming, and Prometheus metrics for hit and savings tracking. It stresses that cache keys must include tenant or user scope, model, prompts and parameters, because similar queries should not share privileged answers. It is written for developers and platform teams running AI features at high request volume. The source is documentation only, with helper scripts and templates not bundled.
Written from the project's SKILL.md and checked against it.
What it can do
- Exact match cacheRedis cache keyed by a hash of model, messages, and temperature.
- Semantic cacheEmbedding-based lookup in Qdrant with a similarity threshold, plus a GPTCache example.
- Gateway semantic cacheDescribes caching at the gateway level with LiteLLM cache or Bifrost's semantic_cache plugin.
- Provider prompt cachingShows Anthropic cache_control blocks and OpenAI automatic prefix caching.
- Cache warmingPre-populates the cache with frequent queries on startup.
- Cache metricsPrometheus counters for cache hits, misses, and estimated savings.
- Redis tuningredis.conf settings for maxmemory and allkeys-lru eviction.
What you need
- Python
- Redis
- Qdrant for the semantic cache examples
- OpenAI API key or Anthropic API key
- Sentence-transformers embedding model for the custom semantic cache
Try asking
- Add an exact match Redis cache in front of my OpenAI chat calls.
- Set up Anthropic prompt caching for a long system prompt.
- Show me how to track LLM cache hits and savings with Prometheus.
Good to know
- Similarity thresholds, latencies and savings are examples, not calibrated guarantees.
- Hashing prompts is not encryption, so stored queries and results need restriction or encryption.
- Temperature 0 does not guarantee deterministic output.
- Cache warming is paid generation and needs bounded concurrency and budget.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/llm-caching/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md13 KB
Alternatives to llm-caching
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
llm-caching: common questions
Can the semantic cache return the same answer to different users?
The source says not to serve a privileged cached answer across users just because queries are similar. Cache entries should be partitioned by tenant or user access scope.
Does OpenAI prompt caching need code changes?
The source says OpenAI caches repeated prefixes of at least 1,024 tokens automatically, with no code change needed.
Which cache layers does this skill cover?
It covers an exact match Redis cache, a semantic similarity cache using Qdrant or GPTCache, and provider-side prompt caching for Anthropic and OpenAI.
How do I install llm-caching?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is llm-caching free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is llm-caching safe to use?
It scores 88 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to llm-caching?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
