Skip to main content
Semantic caching (SCACHE.SET / SCACHE.GET) requires an embedding model to convert text into vectors that Cache-Pot can compare for meaning. Cache-Pot calls any OpenAI-compatible embeddings endpoint you point it at — whether that is OpenAI itself, a local model running in Ollama, or any other provider that speaks the same API.

Required environment variables

Embedding configuration is environment-only. There are no CLI flag equivalents for these three settings.
These three variables are environment-only — there are no --embed-* CLI flag equivalents. Set them before starting the cache-pot process.

OpenAI setup

Export your OpenAI credentials and start the server. Cache-Pot will log semantic cache embeddings enabled via CACHEPOT_EMBED_URL on startup to confirm the configuration was picked up.
export CACHEPOT_EMBED_URL=https://api.openai.com/v1/embeddings
export CACHEPOT_EMBED_KEY=sk-...
export CACHEPOT_EMBED_MODEL=text-embedding-3-small
cache-pot

Ollama (local) setup

Ollama provides a free, local embeddings server that is fully compatible with the OpenAI embeddings API. Pull a model first, then point Cache-Pot at the local endpoint. No API key is needed.
# Start Ollama with an embedding model first
ollama pull nomic-embed-text

export CACHEPOT_EMBED_URL=http://localhost:11434/v1/embeddings
export CACHEPOT_EMBED_MODEL=nomic-embed-text
# No API key needed for local Ollama
cache-pot
Use Ollama during development to avoid API costs entirely. Switch to OpenAI or another hosted provider in production for the best embedding quality and consistency.

Other OpenAI-compatible providers

Any provider that implements the OpenAI embeddings API works with Cache-Pot. Set CACHEPOT_EMBED_URL to the provider’s embeddings endpoint and adjust the model name to match what that provider expects.
export CACHEPOT_EMBED_URL=https://<resource>.openai.azure.com/openai/deployments/<deployment>/embeddings?api-version=2023-05-15
export CACHEPOT_EMBED_KEY=<your-azure-api-key>
export CACHEPOT_EMBED_MODEL=<your-deployment-name>
cache-pot

Verifying the configuration

After starting the server with embedding variables set, run a quick round-trip using redis-cli (or any Redis client) to confirm that semantic caching is working end to end:
SCACHE.SET "test prompt" "test response" 60
SCACHE.GET "test prompt"
# Should return: test response
If SCACHE.SET returns an error such as embedding client not configured, double-check that CACHEPOT_EMBED_URL is exported in the same shell session (or container environment) where cache-pot is running.
The similarity threshold used by SCACHE.GET can be tuned per-call with the THRESHOLD option. A value of 0.9 requires a very close match; lower values (e.g. 0.75) allow fuzzier hits. See the commands reference for full details.