workflows.fit
Back to n8n workflows
n8n templateFreeBy Tihomir Mateev

Reduce LLM Costs with Semantic Caching using Redis Vector Store and HuggingFace

Stop Paying for the Same Answer Twice Your LLM is answering the same questions over and over. "What's the weather?" "How's the weather today?" "Tell me about the weather." Same answer, three API calls, triple the cost...

DevelopmentCore NodesAILangchainHITLSticky NoteLm Chat Open AiMemory Redis Chat
Loading interactive preview...

Template notes

Stop Paying for the Same Answer Twice

Your LLM is answering the same questions over and over. "What's the weather?" "How's the weather today?" "Tell me about the weather." Same answer, three API calls, triple the cost. This workflow fixes that.

What Does It Do?

Semantic caching with superpowers. When someone asks a question, it checks if you've answered something similar before. Not exact matches—semantic similarity. If it finds a match, boom, instant cached response. No LLM call, no cost, no waiting.

First time: "What's your refund policy?" → Calls LLM, caches answer Next time: "How do refunds work?" → Instant cached response (it knows these are the same!) Result: Faster responses + way lower API bills

The Flow

1. Question comes in through the chat interface 2. Vector search checks Redis for semantically similar past questions 3. Smart decision: Cache hit? Return instantly. Cache miss? Ask the LLM. 4. New answers get cached automatically for next time 5. Conversation memory keeps context across the whole chat

It's like having a really smart memo pad that understands meaning, not just exact words.