Understand, onboard, and operate your semantic cache
Version 1.6.0 · November 2026
This guide is for Sulci customers. It explains what Sulci does and why it saves you money, walks you from signup to your first cache hit, covers every feature of the library and the dashboard you’ll use day to day, and shows you how to monitor and manage your usage, plan, and billing.
It deliberately stays on your side of the fence: how Sulci is built internally is covered elsewhere. Everything in these pages is something you can see, configure, or act on yourself.
How to read it. If you’re evaluating Sulci, read Chapter 1. If you’ve just signed up, go straight to Chapter 2 — you’ll have a working cache in under five minutes. Chapters 3 and 4 are the day-to-day references for your code and your dashboard. Chapter 5 covers plans, trials, and billing. Chapter 6 explains the privacy guarantees, and Chapter 7 collects the questions customers ask most, the troubleshooting playbook, and a glossary. Appendix A lists every setting with its self-hosted and Sulci Cloud default, and which value wins.
Versions. This is the November 2026 edition.
It documents sulci==1.6.0 (the Python library on PyPI),
sulci-gateway==1.6.0 (the managed platform), and
@sulci/sulci 0.1.0 for TypeScript — see section 3.9 if you
work in TypeScript rather than Python. 1.0.0 is 0.10.2’s
library, renumbered for general availability (October 27,
2026): the sulci/ package in the 1.0.0 wheel is
byte-identical to 0.10.2’s, so every reading of 0.10.2 in this edition
holds for 1.0.0. From 1.0.0, Semantic Versioning holds for the public
API. 1.0.1 (October 22, 2026) changes one thing, on the
managed backend only: a tenant_id there is refused with
TypeError, because your Sulci account is that backend’s
only partition (section 3.2). 1.1.0 (October 31, 2026)
adds one optional thing: set takes usage=, and
sulci.with_usage(text, usage) lets a
cached_call callable return its answer with the LLM call’s
token counts. On the managed backend those counts feed your dashboard’s
Tokens Saved card (sections 3.2 and 4.1). Nothing that
worked on 1.0.1 changes. 1.1.1 (October 31, 2026)
changes one behaviour on self-hosted backends: they apply the managed
backend’s follow-up rule — a set in a session that already
holds a turn records the turn and stores no entry unless
standalone=True, and a hit counts as a turn. (section 3.4).
1.2.0 (November 1, 2026) carries
standalone through sulci-proxy
(x-sulci-standalone: true), the LiteLLM adapter
(metadata={"sulci_standalone": True}), LlamaIndex
(standalone=True) and the MCP server
(cache_store(standalone=…)); the proxy labels a follow-up
miss miss-followup and no longer forwards its own
x-sulci-* headers upstream. 1.3.0
(November 3, 2026) adds one optional thing: sulci.llm’s
provider helpers make the LLM call and report its token counts for you,
and on the managed backend sulci-proxy and the LiteLLM
adapter send each stored reply’s counts with no code change (section
3.2). Nothing that worked on 1.2.0 changes. 1.3.1
(November 4, 2026) is a documentation release: the same code, with a
README and docstrings that state the defaults Appendix A lists.
1.3.2 (November 6, 2026) changes message text only: on
the managed backend the refusals say that your Sulci account, not your
API key, is the partition, and advise one account per tenant (section
3.2). 1.4.0 (November 9, 2026) adds three optional
keywords to get for self-hosted backends,
variant=, accept= and record_hit=
(Appendix A.3); on the managed backend they are refused, because the
gateway decides there. 1.5.0 (November 17, 2026) adds
observe mode for self-hosted backends: Cache(observe=True)
and sulci-proxy --observe measure what the cache would save
on your traffic without serving a cached answer, and
sulci-observe rates, reports and writes a
run.json that Savings preview imports (sections 3.11 and
4.5). Nothing that worked on 1.4.0 changes. 1.6.0
(November 22, 2026) changes observe mode’s review only: the same
question asked again, an exact repeat, is offered last and
counted on its own, in the report and in run.json (section
3.11). Nothing else changes.
New in this edition on the managed platform: chat completions (section 3.10, Settings › Chat completions in section 4.4) and Savings preview (section 4.5).
Availability. The open-source library is production-ready and on PyPI. The hosted dashboard and the managed tiers are generally available: OSS-Connect is free and self-serve, and Pro and Business are self-serve through Stripe Checkout with a 14-day or 50,000-request trial.
⚠️ Read against 0.10.1 on 2026-10-18, and against 0.10.2
where it changes things (2026-10-19) (defaults re-checked
against 1.3.0 on 2026-11-03 for this edition’s configuration reference,
Appendix A). Every chapter was re-checked against the 0.10.1 library and
the current managed platform, and the context-aware parts again against
0.10.2. Since 0.9.3 (a security release: reserved ids, reserved
metadata keys, per-user sessions, and erasure that raises
when it cannot be confirmed), two releases changed things you may
notice: 0.10.0 added cache.delete_user(), which erases one
end-user on every backend, and made the local backends safe to share
between threads; 0.10.1 made the managed backend send a threshold only
when you set one, so your dashboard’s Threshold applies to Python
callers; and 0.10.2 does the same for context_window and
the new context_threshold, while the managed tier now has
context mode on by default (window 2, context threshold 0.80). Chapter 3
calls each one out. Where this guide and
sulci-oss/CHANGELOG.md disagree, the changelog is
right.
Sulci is the memory layer for AI agents and LLM applications. It sits between your code and the model, and when a new request means the same thing as one already answered — even phrased completely differently, even mid-way through an agent’s reasoning loop — it returns the stored answer instead of calling the LLM again.
Every duplicate it catches saves you the full cost and latency of an LLM call. A cache hit returns in tens of milliseconds; the LLM call it replaces takes seconds and costs real money.
The diagram is the whole mental model: every request your app or
agent makes passes through Sulci first. Sulci embeds the query, looks
for a semantically equivalent one it has seen before (blending in recent
conversation context when the call carries a session_id and
context mode is on), and either returns the stored answer immediately —
a hit — or lets the request continue to your LLM
provider and stores the fresh answer on the way back. Your code doesn’t
change shape; Sulci is a layer, not a rewrite.
A traditional cache matches strings. “How do I deploy to AWS?” and “What’s the process for deploying on AWS?” are different strings, so a string cache misses the second one — and in real traffic, almost nothing repeats verbatim. Sulci instead converts every query into an embedding (a numeric representation of meaning) and matches on similarity: if a new query’s embedding is close enough to a stored one, that’s a hit.
“Close enough” is the threshold, a number between 0
and 1 that you control. Two defaults exist and it is worth knowing which
one you are on: on a self-hosted backend the Python library’s
Cache uses 0.85 unless you set another,
and on the managed tier a lookup that sets none uses your tenant’s
dashboard setting, which defaults to 0.65. You can tune
it per workload: raise it for stricter matching, lower it to catch
looser rephrasings — and check what comes back when you do. Chapter 3
covers tuning, including which of the two numbers a managed call
actually uses.
Conversations make “the same question” harder: “How do I reset it?”
means something different depending on what “it” was three turns ago.
Sulci’s context-aware mode blends the current query’s
embedding with the embeddings of recent turns in the same session, so
the lookup reflects the conversation, not just the sentence. You pass a
session_id on each call; context_window says
how many recent turns to blend. On the managed tier it is on by
default: the gateway blends the last 2 turns unless a request
or your dashboard’s Context window setting (Pro and
above) says otherwise, and any plan can send context_window
per request — the Python Cache sends it when you set it
(sulci 0.10.2+), as does the TypeScript client
(contextWindow). Self-hosted, it is a constructor argument
and off unless you set it (Chapter 3 §3.4).
Be clear-eyed about what it does. Blending changes which stored answers a follow-up can match; it does not by itself make answers more accurate — a blended lookup sits closer to every answer on the conversation’s topic, so at the ordinary threshold it serves more wrong answers, not fewer. What makes it safe is a separate, stricter cutoff for lookups that blended: the context threshold. On our 96-turn conversational benchmark (MiniLM, window 2), one threshold of 0.65 served 18 wrong answers (a model of the managed gateway that reproduces its test runs exactly); with a 0.80 context threshold the gateway itself, on a Sulci Cloud test account on 2026-10-19, served none, and served about 16% of turns from the cache. That is the managed default (0.65 for lookups with no history, 0.80 once blended; Chapter 4 §4.4). The honest trade: a vague follow-up that cannot clear 0.80 goes to your LLM, with its conversation, rather than being served a guess. Measure on your own conversations before you lower it.
Sulci pays for itself when your workload has structural repetition:
| Workload | Expected reuse |
|---|---|
| Planner-reflector agent loops | Highest |
| Tool-using agents re-reading docs/options | High |
| Support / FAQ / developer Q&A | High |
| Novel exploratory work (open-ended research, creative generation) | Lowest |
This ordering is qualitative on purpose. We do not publish a hit rate per agent architecture, because we do not measure one — the shipped benchmark segments by prompt category, not by architecture. The figure we do publish is what a single session does as it warms: 33.4% cold [30.0–35.0], 99.7% warm [99.69–99.81] on the shipped embedder, measured across four seeded corpus draws. Your own rate is the one that matters, and the paragraph below tells you how to read it in a week.
Agents are the headline case, which surprises people: an agent
re-states its own state constantly across iterations, and a single agent
task can issue 50+ LLM dispatches. The repetition is structural, so the
hit rates are high and the savings compound. The exception is genuinely
novel exploration, where each step is new — if that’s your whole
workload, the math may not work, and the honest way to find out is to
point Sulci at a slice of your traffic for a week and read the hit rate
from cache.stats() or your dashboard. If it’s below ~30%,
be skeptical before scaling.
One more honesty note: cached answers are correct for the question that was asked, but they don’t update when underlying facts change. Don’t cache calls whose answers go stale by the minute, or set a short TTL on them (Chapter 3).
Self-hosted (OSS-Connect). The sulci
library runs entirely in your process, against a backend you choose —
SQLite for zero infrastructure, or Qdrant, Redis, Chroma, FAISS, or
Milvus if you already run one. Free forever. Connecting it to your
dashboard (just an API key) gets you visibility: hit rates, trends, and
which of your deployments are alive — from aggregate counts only, never
your queries or responses (Chapter 6). The same free key can also call
the managed gateway (backend="sulci", or the HTTP API from
any language) for up to 10,000 requests a month,
hard-capped — enough to try the managed cache without a card.
Managed (Pro, Business, Enterprise). Your code uses
the same library with backend="sulci", and the cache itself
— vector storage, embedding, expiry — runs on Sulci’s infrastructure at
api.sulci.io. You get the full dashboard (cost saved, hit
rate, latency, top queries, settings, keys, billing) and nothing to
operate, Savings preview to measure what the cache would save on your
own traffic before it serves an answer (section 4.5), and chat
completions, which puts the cache in front of your OpenAI or Anthropic
model with only a base-URL change (section 3.10). Pro and Business start
with a 14-day or 50,000-request trial through self-serve checkout
(Chapter 5). An Enterprise option that runs the managed stack inside
your own VPC is planned and not yet available.
The crucial property: it’s the same library and the same API in every mode. Moving from a laptop SQLite prototype to managed production is a one-line constructor change.
If you’re comparing options, these are the differences that matter in practice:
sulci-oss
repository ships a reproducible benchmark
(benchmark/run.py --use-sulci --agent, in the repo rather
than the PyPI package) you can run yourself before committing, and
runnable LangGraph/CrewAI demos that show the dedupe live (Chapter
3).The most common evaluation question — and the answer is that you’re probably thinking of a different kind of caching. Three categories exist, and they solve different problems:
Provider prompt caching (the feature built into the major LLM APIs) is exact-prefix matching: when the opening tokens of a request — typically a long system prompt or shared document — are byte-identical to a recent request, the provider charges less for those tokens. It’s a per-call discount, not a skipped call: the model still runs, you still wait, and the moment a user paraphrases a question, the prefix differs and nothing matches. Sulci operates on the opposite axis — it matches the meaning of the query and skips the call entirely. The two stack: prompt caching makes your misses cheaper; Sulci makes your duplicates free. Run both.
Exact-match caches (gateway/proxy response caches,
or a Redis GET on the query string) only fire when two
requests are character-identical. Real conversational and agent traffic
almost never repeats verbatim — “how do I cancel?” vs “I want to cancel
my subscription” is a miss — so measured hit rates on this approach are
near zero outside of identical retries.
Building it yourself on a vector database gets you the core of what Sulci is — embed, store, similarity search. What you then build by hand is everything around it: threshold calibration per workload, session-context blending for multi-turn traffic, TTL and expiry sweeping, per-user isolation, cost accounting, and the dashboard. That’s the part that takes months; the similarity search was the easy week.
This chapter takes you from nothing to a working, dashboard-connected cache. Budget five minutes.
Go to sulci.io/signup. The form asks for your email,
what you are building, your expected daily query volume, and a tier, and
it asks you to agree to the Master Subscription Agreement, Privacy
Policy and Acceptable Use Policy before it will submit. That agreement
is recorded with your signup.
accounts@sulci.io, usually
within a minute. The key looks like sk-sulci-… and is sent
exactly once — store it somewhere safe. If you sign up again with the
same email, you are told a key already exists and shown its prefix; the
key itself is never re-sent.Sign in at dashboard.sulci.io. On first sign-in you’ll
be asked to paste the API key from your signup email — a one-time step
that links your login to your account. After that, the dashboard
remembers you.
Paid signups get a different first step: after checkout you land on a welcome page that says check your email, and the invitation in that email creates your login with the checkout address and links your key automatically — no paste.
Prerequisites, all standard:
llamaindex, mcp, litellm and
proxy extras need 3.10+. Check with
python3 --version.python3 -m pip install --upgrade pip. Old pips resolve the
dependency tree slowly or pick source builds over wheels.python3 -m venv .venv
source .venv/bin/activateOn Windows, activate with .venv\Scripts\activate
instead.
Any environment manager works the same way — uv venv,
conda, poetry; Sulci has no special requirements. Two situational
notes:
[sqlite], [qdrant], …)
pull in sentence-transformers and PyTorch, and the default embedding
model downloads on first use — budget ~1 GB of disk and expect the first
install to take a few minutes on slow links. Managed-only usage
(backend="sulci") skips all of that: the gateway embeds for
you.pypi.org; runtime (managed mode and dashboard telemetry)
needs outbound HTTPS to api.sulci.io:443. The local
embedder downloads its model from Hugging Face
(huggingface.co and its CDN) on first use and checks it for
updates afterwards: download it ahead of time and set
HF_HUB_OFFLINE=1 (and use no API key) to run with no
outbound access. If your environment uses a proxy, standard
HTTPS_PROXY env vars apply.Self-hosted, zero infrastructure:
pip install "sulci[sqlite]"Or, for managed-only usage (no local embedding dependencies):
pip install sulciThe quotes matter in zsh. Other backend extras exist
([qdrant], [redis], [chroma],
[faiss], [milvus]) — install the one matching
your infrastructure.
Self-hosted:
from sulci import Cache
def call_your_llm(prompt: str) -> str: # stand-in for your real LLM call
return f"answer to: {prompt}"
cache = Cache(backend="sqlite", db_path="./sulci_db")
response, similarity, context_depth = cache.get("How do I deploy to AWS?")
if response is None:
response = call_your_llm("How do I deploy to AWS?")
cache.set("How do I deploy to AWS?", response)get() always returns three values: the cached response
(or None on a miss), the similarity score, and how many
prior turns were blended into the lookup (0 unless you use
context mode, §3.4).
To connect this self-hosted cache to your dashboard, set
SULCI_API_KEY to your key before running it (or pass
api_key="sk-sulci-…" to Cache). Only aggregate
telemetry is sent; your queries and responses stay local.
Managed: set your key in the environment first
(export SULCI_API_KEY= followed by your
sk-sulci-… key), then:
from sulci import Cache
def call_your_llm(prompt: str) -> str: # stand-in for your real LLM call
return f"answer to: {prompt}"
cache = Cache(backend="sulci") # runs on Sulci's infrastructure; reads SULCI_API_KEY
result = cache.cached_call("How do I deploy to AWS?", call_your_llm)
print(result["response"], result["cache_hit"], result["latency_ms"])An OSS-Connect key works here too, for up to 10,000 managed requests
a month. Everything else is identical; cached_call does the
get-call-set dance for you, and works the same on a self-hosted cache.
Prefer the environment variable over hardcoding the key —
Cache reads SULCI_API_KEY when you don’t pass
api_key=.
Run a query twice — ideally rephrased the second time — then:
cache.stats() shows
hits, misses, hit_rate,
total_queries and saved_cost.dashboard.sulci.io. On the managed tier, Cost Saved / Hit
Rate / Monthly Requests move within about a minute of your first call.
Passing api_key= to Cache(...) (or setting
SULCI_API_KEY) also turns on the library’s lightweight
telemetry, which flushes every 30 seconds and on process exit and drives
the trend chart, the deployments list and the activity feed. Only
aggregate counters cross the wire — never your queries or responses
(Chapter 6).If the dashboard stays empty, Chapter 7’s first section walks the three failure modes that look identical but have different fixes.
The day-to-day reference for sulci in your code. Current
release: 0.10.1.
from sulci import Cache
cache = Cache(
backend="sqlite", # sulci|sqlite|qdrant|chroma|redis|faiss|milvus
db_path="./sulci_db", # where self-hosted backends keep files
api_key=None, # your sk-sulci-… key, or set SULCI_API_KEY
threshold=None, # hit cutoff (0–1); unset = 0.85 self-hosted
ttl_seconds=86400, # entry expiry; None = never
personalized=False, # True = scope entries to user_id
context_window=None, # unset: stateless self-hosted; Sulci Cloud uses your
# setting (default 2). 0 = stateless everywhere
cost_per_call=0.005, # USD per avoided call (feeds saved_cost)
embedding_model="minilm", # minilm | mpnet | bge | openai
telemetry=True, # False opts out of dashboard telemetry
)Every value above except backend and
db_path is the library default. Two defaults surprise
people: backend defaults to
"chroma", not SQLite, so always name your backend;
and threshold defaults to unset
(None), which means 0.85 on a self-hosted backend
and your dashboard’s Threshold on backend="sulci" (§3.3).
Leave context_window unset rather than 0: on
backend="sulci" a 0 is sent with every lookup
and turns off your account’s default window of 2. Every setting, with
its self-hosted and Sulci Cloud default: Appendix A.
Backends. sulci sends cache operations
to the managed gateway — nothing to run locally, and the gateway does
the embedding for you (the embedding_model you pass is not
used on this path). The self-hosted backends store each entry (vector,
query and response text) in a database you control: sqlite
needs nothing installed, qdrant is the production-grade
choice, and
chroma/redis/faiss/milvus
fit teams who already run those. Cache(backend="...")
passes only db_path to a self-hosted backend; to point at a
Qdrant, Redis or Milvus server, construct the backend yourself
and pass the instance as backend=.
Embedding models. minilm (the default,
384 dimensions) is fast and free; mpnet and
bge (768 dimensions) trade latency for quality;
openai uses OpenAI’s embedding API and needs the extra
(pip install "sulci[openai]") as well as
OPENAI_API_KEY.
| Call | What it does |
|---|---|
cache.get(query, *, threshold=None, tenant_id=None, user_id=None, session_id=None) |
Returns (response_or_None, similarity, context_depth).
Self-hosted only (1.4.0): variant=, accept=
and record_hit= (Appendix A.3) |
cache.set(query, response, *, tenant_id=None, user_id=None, session_id=None, metadata=None, usage=None) |
Stores the pair (and records the turn in the session, self-hosted).
usage (1.1.0) is the LLM call’s token counts — below |
cache.cached_call(query, llm_fn, *, threshold=None, tenant_id=None, user_id=None, session_id=None, cost_per_call=None) |
get → on miss, call llm_fn(query) → set; returns a dict
with response, source,
similarity, latency_ms,
cache_hit, context_depth |
cache.stats() |
{hits, misses, saved_cost, total_queries, hit_rate},
plus active_sessions when context mode is on |
cache.clear() |
Delete every entry and every conversation history this cache holds; returns nothing |
cache.delete_user(user_id, *, tenant_id=None) |
Delete one end-user’s entries and conversation histories (needs
personalized=True); returns
{"entries": N, "sessions": M} |
AsyncCache has the same constructor and
aget / aset / acached_call /
astats / aclear / adelete_user
for asyncio code.
Per-user isolation needs
personalized=True. With the default
personalized=False, Cache
ignores the user_id you pass and every
user shares one cache. Construct with personalized=True and
entries — and conversation histories — are partitioned per user: user A
never receives an answer cached for user B. Use it whenever cached
responses could contain user-specific content. tenant_id
partitions the same way, on every backend. Except the managed
backend. On the managed backend (backend="sulci",
Sulci Cloud) your Sulci account is the only partition — every API key on
the account reads and writes the same cache: the SDK never sent
tenant_id, so before 1.0.1 a tenant scope was dropped there
without a word and one cache was shared across every tenant (and model)
you passed. From 1.0.1, get, set and
cached_call raise TypeError for a
tenant_id on the managed backend, as
delete_user already did. To keep tenants apart on Sulci
Cloud, give each tenant its own Sulci account; a second API key on the
same account shares that account’s cache. If one account must serve
several tenants, construct with personalized=True and pass
the tenant’s id (or "tenant:user") as user_id:
answers are then never shared across those ids, and
DELETE /v1/cache/user/{user_id} erases one. Section 6.6
sets the three levels (account, customer, conversation) side by side,
with a support-chatbot example.
Token counts — Tokens Saved (1.1.0). Your
dashboard’s Tokens Saved card shows the tokens your managed cache hits
saved, as your app reports them. Sulci never sees your provider’s
response — your own function makes that call — so the counts reach it
only if you hand them over with the answer (or, from 1.3.0, let
sulci.llm, sulci-proxy or the LiteLLM adapter
do it — below):
import sulci
def ask_claude(question):
msg = client.messages.create(model="claude-haiku-4-5", max_tokens=300,
messages=[{"role": "user", "content": question}])
return sulci.with_usage(msg.content[0].text, msg.usage) # text, carrying its token counts
result = cache.cached_call("How do I deploy to AWS?", ask_claude) # result["response"] is plain text
cache.set(question, answer, usage=resp.usage) # the same, when you store an answer yourselfAnthropic’s, OpenAI’s and Gemini’s usage objects are read as they
are, or pass a mapping with input_tokens and
output_tokens. On the managed backend the counts are stored
with the entry, and every later hit on it adds them to Tokens Saved.
They are optional: an answer stored without them is cached and served
exactly the same, and its hits add nothing to the card. A self-hosted
backend accepts them and stores nothing. A value set cannot
read raises TypeError or ValueError before
anything is stored; with_usage only warns, because by then
the LLM call has been paid for and the answer is never lost over a
statistic.
Or let sulci make the call (1.3.0).
sulci.llm builds the function for you. It calls your own
client and returns the answer with the call’s token counts, so on the
managed backend every answer it stores carries them — whenever the
provider returns usage — without a with_usage line:
import anthropic, openai
from google import genai
from sulci import Cache, llm
cache = Cache(backend="sulci")
ask = llm.anthropic(anthropic.Anthropic(), model="claude-haiku-4-5", max_tokens=300)
result = cache.cached_call("How do I deploy to AWS?", ask) # result["response"] is plain text
ask = llm.openai(openai.OpenAI(), model="gpt-5-mini") # OpenAI, or an OpenAI-compatible client
ask = llm.gemini(genai.Client(), model="gemini-2.5-flash") # Gemini (google-genai)Every token the avoided call would have used is counted: prompt-cache
input as input, reasoning and thinking tokens as output. The helpers
take the provider’s sync client and refuse, with a
TypeError that says why, stream=True (a
stream’s counts are never guessed), tools and more than one choice
(n or candidate_count above 1; their counts
are not this answer’s); write your own function for those. A reply with
no text, or one that asks for a tool, raises
sulci.llm.NoTextError and nothing is cached. If you run
sulci-proxy or the LiteLLM
adapter on the managed backend, 1.3.0 sends each stored reply’s
counts for you with no code change (not for streamed calls, tool calls
or more than one choice) — see the Integration Guide.
Reserved ids (0.9.3). "global" names
the shared scope, so get, set and
cached_call raise ValueError for a
tenant_id — or, with personalized=True, a
user_id — that is "global", "",
0 or False. Pass None to mean “no
tenant” or “no user”, and map empty ids to None before
calling.
Reserved metadata keys (0.9.3).
set(..., metadata={...}) raises ValueError if
the dict uses one of the entry’s own field names — key,
query, response, tenant_id,
user_id, expires, created — and
TypeError if metadata is not a mapping.
Nothing is stored or sent when it raises.
Deletion is real deletion. clear()
removes the underlying entries and the session histories. On the managed
tier, if the gateway cannot confirm the erasure, clear()
raises sulci.errors.SulciErasureError rather than returning
as if it had worked — catch it if your code must carry on. Deletion
always works, even if you’re over quota.
Deleting one user’s data. Since 0.10.0,
cache.delete_user(user_id) erases one end-user on every
backend — their cache entries and their conversation histories — and
returns the counts:
from sulci import Cache
cache = Cache(backend="sqlite", db_path="./sulci_db", personalized=True)
cache.set("What is my plan?", "You are on Pro.", user_id="user-123")
print(cache.delete_user("user-123")) # {'entries': 1, 'sessions': 0}Pass the same user_id (and, self-hosted, the same
tenant_id=) your application passed to get and
set. The cache must be personalized=True —
without it nothing is filed under a user, so delete_user
raises ValueError and clear() is the erasure
route. Repeating the call is safe and completes an erasure that failed
part-way; a failure raises sulci.errors.SulciErasureError.
On backend="sulci" the API key decides the tenant, so
tenant_id is refused there, and the call goes to the HTTP
endpoint, which any language can call directly:
curl -s -X DELETE "https://api.sulci.io/v1/cache/user/user-123" -H "X-Sulci-Key: $SULCI_API_KEY"URL-encode the id; any id is accepted except global and
the empty id, which are refused with 422. The response is
{"status": "ok", "deleted": N, ...} and the erasure also
removes that user’s conversation history. If the deletion could not be
completed the gateway answers 503 with error
erasure_incomplete — repeat the call.
cache.clear() remains the way to remove everything, on
every backend.
Cost accounting. stats()['saved_cost']
accrues cost_per_call on every hit — including hits through
the raw get()/set() path and framework
integrations. Set cost_per_call=0 if you don’t want the
estimate.
The threshold is the single most consequential knob. Symptoms and adjustments:
personalized=True /
session_id partitioning.Which threshold a managed call uses. On the managed
tier the gateway applies, in order: the threshold sent with the request,
then your tenant’s Threshold setting (Chapter 4), then
the platform default of 0.65. Since sulci 0.10.1 the Python
Cache sends a threshold only when you set one — on the
constructor (threshold=), by assignment
(cache.threshold = 0.9), or per call
(get(..., threshold=0.9)). Leave it unset on
backend="sulci" and your dashboard setting applies; set one
and it overrides the dashboard for those lookups. (On 0.10.0 and earlier
the Python Cache always sent 0.85, so the dashboard setting
never applied — upgrade, or pass threshold=0.85 if you want
to keep that comparison.) On the managed backend
cache.threshold reads None until you set one.
The TypeScript client and direct HTTP calls that omit
threshold use the dashboard setting too.
from sulci import Cache
cache = Cache(backend="sqlite", db_path="./sulci_db", context_window=4)
cache.set("My router keeps dropping Wi-Fi.", "Restart it and update its firmware.", session_id="conv-42")
response, similarity, context_depth = cache.get("How do I reset it?", session_id="conv-42")
print(response, similarity, context_depth)With context_window=4, each lookup blends the query’s
embedding with up to four previous turns in that session. Sessions
expire after an hour of inactivity by default
(session_ttl=3600, with the built-in session store; see
Appendix A). Two finer knobs exist — query_weight (how much
the current query dominates the blend, default 0.70) and
context_decay (how fast older turns fade, default
0.50).
A blended lookup needs its own cutoff,
context_threshold, used only when blending
actually happened; the library warns (once per Cache) when
a blended lookup runs without one. The library ships no default. On our
96-turn conversational benchmark (MiniLM, window 2), one threshold of
0.65 served 18 wrong answers (a model of the managed gateway that
reproduces its test runs exactly); with a 0.80 context threshold the
gateway itself, on a Sulci Cloud test account on 2026-10-19, served
none, and served about 16% of turns from the cache. For an app that
stores self-contained rewrites of its follow-ups
(standalone=True, below), 0.80 still served 13 wrong of 96
and 0.90 served 1. Start from 0.80 (0.90 for rewritten follow-ups), then
calibrate on held-out follow-ups from your traffic, checking wrong
answers as well as hit rate. Since 0.10.2 get and
cached_call also take context_threshold= per
call.
Since 0.9.3 a session belongs to one tenant and (with
personalized=True) one user: pass the same
tenant_id / user_id to
get_context, clear_context and
context_summary as to get and
set.
On the managed tier context mode works differently:
context_window field of the lookup request if you send one,
otherwise your tenant’s Context window setting (default
2). Any plan can send it per request; changing the
dashboard setting needs Pro or above. Since sulci 0.10.2 the Python
Cache sends context_window when you set it
(capped at 20) and nothing when you leave it unset, so the tenant
setting applies; 0.10.1 and earlier never sent it.context_threshold, the request’s threshold,
your tenant’s Context threshold setting (default
0.80). A lookup with no history uses the threshold
chain above (default 0.65). The Python Cache sends
context_threshold when you set it per call, or on the
constructor for calls that pass no threshold of their own
(a call’s own threshold then covers both).set in a session that already has a turn
records the turn but stores no entry, because a
follow-up’s words (“how do I fix it?”) only mean something inside its
conversation. The first question of a session, and calls without a
session_id, are stored as usual. A query that stands on its
own — a rewritten follow-up, or an agent prompt with its state written
in — can say so: set(..., standalone=True) /
cached_call(..., standalone=True) (sulci 0.10.2+) stores it
in any session.The last rule is no longer a difference: since sulci 1.1.1
the library applies it on every backend — a follow-up in a
session is answered and recorded, not stored, unless
standalone=True. Blending still helps a follow-up’s
lookup find its conversation’s earlier, self-contained entries;
it is strongest one turn back, and several unrelated turns dilute
it.
ttl_seconds controls how long entries live (default one
day). Pick TTLs by how fast your answers go stale: documentation answers
can live for days; anything pricing- or inventory-shaped should be
short, or not cached at all.
On the managed tier every entry currently expires after the platform TTL of 24 hours: per-call and per-tenant TTLs are accepted but not yet enforced, and expired entries are swept automatically.
An agent loop repeats itself when the same task runs again — a retry, another environment, tomorrow’s deploy — and the calls whose state recurs can be served from the cache. Three conditions, all measured on the Acme demo’s planner-reflector loop (MiniLM). First, each prompt must carry its state — the task, the steps done, the last tool output — as agent frameworks build them anyway: bare questions such as “what’s the next step?” are not cacheable at any threshold (in a production run “What is the next step to deploy to AWS?” scored 0.957 against “What is the first step…” and was served its answer). Second, a strict per-call threshold: at 0.95 the second and third runs served 11 of their 12 calls from the cache with none wrong (2026-11-01), and the step whose tool output was a failure (0.927 against the cached success) still went to the LLM. Of those 11, 8 were prompts that recurred word for word and 3 matched by meaning (a different tool output). Below 0.95 it is not safe: on the first, cold run, “plan step 2” scored 0.934 against “plan step 1”, whose answer is a different step.
Third, no session_id on an agent call whose
prompt carries its own state. standalone=True says
such a prompt stands on its own, but as of sulci 1.2.0 (still so in
1.3.0) it affects storage only — it lets the answer be stored inside a
session that already holds turns. The lookup still blends the session’s
recent turns into the query, and a state-carrying prompt gains nothing
from them: in a run on the managed backend, a “next step?” prompt
blended with the previous “did it succeed?” prompt scored exactly 0.950
against that prompt’s entry and was served its “yes, it succeeded”
(2026-11-01). Without a session there is nothing to blend, and nothing
to withhold from storage either:
r = cache.cached_call(query=prompt, llm_fn=call_agent_llm, threshold=0.95) # no session_id: the prompt is the stateKeep session_id for conversational turns, where the
history is what makes a follow-up mean something. There are two
integration patterns, and every framework fits one of them:
LangChain / LangGraph — one line makes every LLM
call in your chains and graphs route through Sulci
(pip install "sulci[langchain]"):
from langchain_core.globals import set_llm_cache
from sulci.integrations.langchain import SulciCache
set_llm_cache(SulciCache(backend="sulci", namespace_by_llm=False)) # reads SULCI_API_KEYKeyword arguments pass straight through to Cache, so
name the backend — SulciCache inherits Cache’s
"chroma" default. Self-hosted,
namespace_by_llm=True (the default) keeps a separate store
per model so one model’s answers are never served for another; on
backend="sulci" it has no effect and only logs a warning,
hence False above. The stock adapter is stateless:
LangChain’s cache interface passes no conversation, so
context_window has no effect on it (since 0.10.1, passing
one logs a warning). For context-aware caching use
cache.cached_call(..., session_id=...) or the LlamaIndex
adapter.
CrewAI and other agent frameworks — subclass the
framework’s LLM base, intercept the call, route through
cache.get()/cache.set(). The library ships
runnable demos of both patterns:
examples/agent_example_langgraph.py and
examples/agent_example_crewai.py. Each runs the same agent
task three times and prints the cold → warm → hot progression so you can
see the dedupe with your own eyes (they fall back to a deterministic
mock if no LLM key is set).
Measuring your agent workload. The benchmark harness
is in the sulci-oss repository, not in the PyPI package.
From a clone,
python benchmark/run.py --use-sulci --fresh --no-sweep --agent --seed 1 --out /tmp/sulci-bench
runs it on the shipped embedder (without --use-sulci it
measures a TF-IDF stand-in that ships in no product; without
--out it refuses to write beside the committed result
draws). It simulates agent traffic (50 sessions × 200 dispatches by
default) and reports per-session hit rates and per-category breakdowns —
a fast way to estimate savings before wiring up production traffic.
The repository’s examples/ directory is a working
catalogue, not decoration. The examples that call an LLM fall back to a
deterministic mock when no API key is set, so you can run them in a
sandbox or CI. The recommended path for any new integration:
pick the example closest to your stack, run it unmodified, then
swap our pieces for yours.
| Example | What it shows | Start here if… |
|---|---|---|
basic_usage.py |
The minimal get → miss → set → hit loop; no API key needed | You’re evaluating and want a 60-second proof |
context_aware.py |
Ambiguous follow-ups (“how do I fix it?”) with and without context blending | You’re building anything conversational |
anthropic_example.py |
Production-shaped Claude integration with context awareness | Claude is your provider |
async_example.py |
AsyncCache — non-blocking caching for async apps |
You’re on FastAPI/asyncio |
langchain_example.py |
The one-line set_llm_cache pattern across chains |
You’re on LangChain |
llamaindex_example.py |
Caching inside a LlamaIndex pipeline | You’re on LlamaIndex |
litellm_example.py |
SulciLiteLLMCache under LiteLLM |
You’re on LiteLLM |
proxy_example.py / mcp_example.py |
The sulci-proxy and sulci-mcp
surfaces |
You can’t change the calling code, or you’re wiring an agent |
agent_example_langgraph.py |
A 2-node planner→actor graph run 3× — watch cold → warm → hot in the printed stats | You’re building agents on LangGraph |
agent_example_crewai.py |
A 2-agent Crew with the LLM-subclass intercept pattern, same 3-run warm-up | You’re on CrewAI (or any non-LangChain framework — the recipe transfers) |
extending_sulci/custom_backend.py |
Implementing the Backend protocol yourself |
You run a vector store we don’t ship |
Adapting one to your needs is usually three substitutions:
(1) your LLM call where the example calls its mock or
demo client; (2) your queries — replace the canned
prompts with a sample of real traffic, because that’s what makes the
printed hit rate meaningful; (3) your configuration —
backend, threshold, context_window, and
cost_per_call set to your reality. The agent examples are
deliberately built as warm-up loops (the same task three times) so that
after substitution you immediately see whether your workload
exhibits the cold → warm → hot pattern; if run three is barely cheaper
than run one, check first that your prompts carry their state and recur
word for word where the state does; lowering the threshold to force hits
is how an agent gets served another step’s answer.
There’s also a complete reference application — a support bot with multi-turn scenarios, downloadable from the Documentation page on sulci.io — which is the best model for a “whole app” integration rather than a single call site.
Pro and above can issue multiple API keys from the dashboard (Chapter
4) — use one per environment (dev/staging/prod) so you can rotate or
revoke independently. Every key on an account reads and writes the same
cache, though, so an answer cached in dev can be served in production;
environments that must never share answers need their own Sulci accounts
(section 3.2). Telemetry flushes every 30 seconds and on process exit,
so short-lived scripts still report to the dashboard. To opt out of
telemetry entirely, pass telemetry=False.
Everything above uses the Python library, which runs the cache in
your process. If you’re not in Python, you reach the same cache a
different way: the hosted API, and for TypeScript
there’s an official client,
@sulci/sulci.
npm install @sulci/sulciIt’s a thin, fail-open wrapper over the REST endpoints — there’s no
engine to run locally; calls go to api.sulci.io. The shape
mirrors the Python cached_call: look up, and on a miss run
your function and store the result.
import { SulciClient } from "@sulci/sulci";
const sulci = new SulciClient({
apiKey: process.env.SULCI_API_KEY, // sk-sulci-...
onError: (e) => console.warn("[sulci]", e), // observe, never crash
});
async function callYourLLM(prompt: string): Promise<string> {
return `answer to: ${prompt}`; // stand-in for your real LLM call
}
async function main() {
const { source, response } = await sulci.cachedCall(
{ query: "How do I deploy to AWS?" },
() => callYourLLM("How do I deploy to AWS?"),
);
console.log(source, response); // "llm" the first time, "cache" on a semantic match
}
main();Save it as demo.ts and run it with
npx tsx demo.ts (Node 18 or newer).
Fail-open is the default — if the cache is ever unreachable, your LLM
call still runs, so the cache can never take down the app it caches for.
Omit threshold and contextWindow to use your
dashboard settings, or pass them to override per call. Pass a
sessionId for the context-aware behaviour described in
§3.4; the result’s contextDepth reports how many prior
turns were blended, on a hit or a miss. Errors surface
as a structured SulciError — note that
quota_exceeded (your monthly cap) and
rate_limit_exceeded (slow down) are both HTTP 429 but mean
opposite things, so branch on the error code, not the status.
A note on naming: the package is @sulci/sulci, not a
bare sulci — npm’s similarity filter reserves the shorter
name. The import and install both use the scoped form. Every other
language (Go, Java, Ruby, curl) talks the same REST contract directly;
runnable examples for each live in the API reference.
If your app already calls OpenAI’s or Anthropic’s models through an
OpenAI-compatible client, Sulci Cloud can sit in front of the model with
no library at all: point the client’s base URL at
https://api.sulci.io/v1, send your Sulci key, and Sulci
answers from the cache on a hit and calls your provider, on the provider
key you saved, on a miss (Pro and above; set it up under Settings › Chat
completions, section 4.4). Follow-ups, answers that name a record,
cut-off answers and streams are never served from the cache. The Chat
Completions API page, linked from sulci.io’s Documentation page, has the
request headers, what is cached and what never is, and the errors.
Before a cache answers your users, you can measure what it would do on their real traffic. On Sulci Cloud that is Savings preview (section 4.5): switch a key to observe mode in the dashboard. If your traffic must stay in your own network, the library does the same on a self-hosted backend:
from sulci import Cache
cache = Cache(backend="qdrant", threshold=0.85, observe=True) # records to ./sulci_observe.dbor, with no code change,
sulci-proxy --backend qdrant --observe in front of your
app. Every lookup runs and is then turned away, so your LLM answers
every call and your users see no change; the library records, in one
local SQLite file readable only by its owner, what the cache would have
served. Nothing is sent to Sulci. Keep every other setting as you would
run it live.
Then rate samples and read the numbers with
sulci-observe (the same as
python -m sulci.observe):
sulci-observe rate sulci_observe.db --reviewer alice
sulci-observe report sulci_observe.db
sulci-observe summary sulci_observe.db --out run.jsonrate shows your reviewer the question and the two
answers in random order and asks one question: would you send the cached
answer to this asker, unchanged? Since 1.6.0 it asks about rewordings
first and exact repeats last (the same question asked again,
similarity 0.9995 or above), marked as such: a repeat is where a cached
answer is least in doubt, but it is still rated and still counts toward
the wrong-hit bound, since an answer can be out of date or about someone
else. Exact repeats hold at most a quarter of the kept samples.
report gives the hit rate, requests and tokens saved and a
95% upper bound on wrong hits at thresholds 0.75–0.95.
summary writes run.json: the same numbers,
with no text and no hashes. Import it in Savings preview (section 4.5)
for savings at your prices, a tuning review and a verdict. The file of
review samples holds your users’ questions and answers and is not
encrypted by the library: keep it where you keep that traffic, and
sulci-observe forget erases them. On
backend="sulci", observe=True raises
TypeError: use the dashboard’s observe mode there.
dashboard.sulci.io gives you a live read on what your
cache is doing without instrumenting anything yourself. This chapter
covers every page and what to do on it.
A note on auth: the dashboard signs you in with your own login and holds your API key server-side on your behalf — your browser never sees the raw key.
A note on appearance: the theme menu in the header offers System, Light and Dark. System follows your operating system’s setting.
The home page adapts to your plan.
OSS-Connect (self-hosted cache, dashboard for visibility, plus a small managed allowance):
Five stat cards: Tokens Saved (this month, as your app reported them — see below), Cost Saved (estimated this month), Hit Rate (across all deployments), Requests this month, and Active SDKs (how many distinct deployments have reported — an anonymous fingerprint, never identifying). ::: internal :::
A 30-day hit-rate trend chart.
Managed API requests — your calls to
api.sulci.io this month against the 10,000 allowance. The
limit is enforced: calls above it return 429.
Self-hosted requests — what the library reports from your own process. No cap: the cache runs on your side, so there is nothing for us to limit, and only aggregate counts reach us.
An Active deployments table — one row per deployment fingerprint seen in the last 7 days, with last-seen timestamps. You can see at a glance whether your dev box and prod cluster are both reporting, whether one went quiet, or whether teammates are running uncoordinated copies.
A Considering managed Sulci? panel with upgrade buttons for Pro and Business and a link to compare plans. Each button starts Stripe Checkout; if paid self-serve is ever switched off, they are shown disabled.
Pro and Business (managed cache):
A brand-new account also sees a short getting started panel with the three lines of code that produce a first call, and beside them how to report token counts for Tokens Saved (section 3.2).
Business currently shares the Pro layout with Business labels, quota, and pricing; dedicated Business surfaces (team management and a tenant-wide audit log) are on the roadmap. Enterprise accounts are fully provisioned at the gateway level; the Enterprise-specific dashboard surface is coming.
/audit is a full workbench over your SDK’s telemetry
batches — one row per batch the library reported under the key your
dashboard is linked to, with hits, misses, average latency, backend, SDK
version and deployment fingerprint. Account events such as key rotations
and plan changes are not in this feed today. It never contains your
query text or responses — that’s a hard guarantee, not a display choice
(Chapter 6).
The feed supports server-side pagination (20 per page), column
sorting (When / Event / Hits / Misses / Latency), and filters (event
type, deployment-fingerprint prefix). All of it lives in the URL —
?page=3&sort=hits&dir=desc&event=cache.get is a
shareable link to exactly that view.
From /keys you can:
sk-sulci-… is
shown exactly once; copy it before closing.Pro includes up to 5 keys, Business up to 25, and Enterprise up to
100. Your own cap is shown on the Keys page as key_limit,
which is the authoritative number for your account. Keys are
credentials, not partitions: every key on your account reads
and writes the same cache, so issuing a second key does not give anyone
a separate cache. One key on your account is the anchor (the
one created at signup, which links your dashboard login to your
account); it can’t be revoked directly — rotate it instead, which moves
the anchor to the replacement in one step. Your last remaining key can’t
be revoked either.
Best practice: one key per application or environment, so each can be
rotated or revoked on its own; rotate on team departures, and watch
last seen for keys that should be dead. An environment that
must not share answers with another (staging and production, say) needs
its own Sulci account, not only its own key.
/settings has two tabs: Cache
configuration and Chat completions.
Cache configuration has four editable settings, applied to your managed cache from your next request:
| Setting | Default | What it does |
|---|---|---|
| Threshold | 0.65 | Similarity cutoff for a lookup with no conversation
history (a stateless call, a session’s first turn). Lower =
more hits, looser matching. Used when a request does not send its own
threshold — since sulci 0.10.1 the Python Cache sends one
only if you set it in code, so leave it unset there to use this setting
(Chapter 3 §3.3). |
| Context window | 2 | Past turns of a session blended into each lookup (0 = stateless, up
to 20). Needs a session_id on each call. |
| Context threshold | 0.80 | Similarity cutoff for a lookup that blended
history; no effect at Context window 0. On our 96-turn benchmark, 0.80
served no wrong answer to follow-ups sent as users type them; an app
that stores self-contained rewritten follow-ups
(standalone) had far fewer wrong answers at 0.90 (1 of 96,
against 13 at 0.80). |
| LLM cost per call | 50 (= $0.005/call) | Your LLM cost estimate; drives the Cost Saved card. |
Set the cost per call to your actual blended LLM cost — the Cost Saved card is only as honest as this number. Three read-only rows show what the managed gateway runs for you: the embedding model, the vector backend, and the cache TTL — which is shown so an existing value is not hidden, but is not yet enforced: the platform default of 24 hours applies to every entry.
Chat completions sets up Sulci’s OpenAI-compatible
chat route (POST /v1/chat/completions, Pro and above),
which calls your model provider on a miss and answers from the cache on
a hit, so your app changes only its base URL. The account owner:
Every change on this tab is emailed to the account owner. The route itself (headers, what is cached and what never is, streaming, errors) is documented on the Chat Completions API page, linked from sulci.io’s Documentation page.
/savings-preview answers “how much would Sulci save us,
and would it ever serve a wrong answer?” on your own traffic, before a
single cached answer reaches your users. It is on every plan,
OSS-Connect included, so you can measure without a card. The
judge (below) and observe mode on chat
completions are on Pro and above, trials included, because both
use the provider key saved under Settings › Chat completions.
Observe mode, on a key. Each of your keys has an
Observe… switch here (it asks first, and every change
is emailed to the account owner). A key in observe mode is never
answered from the cache: on chat completions Sulci always calls
your provider and returns its answer; on /v1/cache/get it
always answers a miss, so your code calls your model as on any miss.
Sulci records what the cache would have done: a would-be hit is
a call whose closest cached question scored at or above your threshold,
and the lookup also looks down to 0.75 so the report can show other
thresholds. Each observed response carries an
x-sulci-observe header (would-hit,
would-miss or would-refuse), with
x-sulci-observe-similarity when there was a candidate.
Observed calls are counted and billed as misses, which is what they are.
Use a key made for the trial run, so switching it back does not change
your production traffic.
On OSS-Connect, observe mode works on the cache
routes (backend="sulci", sulci-proxy in
managed mode, or /v1/cache/get and
/v1/cache/set over HTTP), and your account has one hosted
key: while it observes, your app gets no cache hits from Sulci and every
call goes to your model (the switch says so before it changes anything).
Observed calls count toward the 10,000 managed requests a month like any
other; calls refused after the limit are not observed, and the report
says so when the limit was reached. The money check compares your
savings with Pro’s price, the plan that would serve the hits (you can
enter another), and the report offers Start a Pro trial
under the verdict. Your runs, ratings and switches stay with your
account when you upgrade.
The report (a key’s Report button) shows, for the last 14 days by default (up to 60):
Rating samples. Review samples shows would-be hits at similarity 0.80 or above: the question, the answer the cache would have served and your model’s answer. Rate each Acceptable, Not acceptable or Can’t tell: would you send the cached answer to this asker, unchanged? About 100 ratings give a useful bound. Exact repeats, the same question asked again (similarity 0.9995 or above), are tagged Exact repeat and shown last: still worth a look, as an answer can be out of date or about someone else, so they are rated and count in the wrong-hit bound like any sample. They hold at most a quarter of the samples kept, and where a key has some, the report shows how many of the would-be hits and rated samples are exact repeats, for example “8 (6 exact repeats)”; the rest are rewordings, the part the threshold decides.
The judge (optional). The Judge tab can have a small model rate samples the way your reviewers do, on your own provider key saved under Settings › Chat completions. It shows the calls and tokens a run will send before anything is sent. Its figures appear in the report only once it agrees with your reviewers (at least 50 samples rated by both, at least 5 of them rated Not acceptable by your reviewers, and Cohen’s κ of 0.6 or more), always beside your reviewers’ figures, and never change the verdict. You rate first: a sample’s judge rating is shown only after you have rated it.
Print / save as PDF turns the report into an A4 document (black on white, savings from page 2) to share inside your company.
Self-hosted runs. If your traffic can’t leave your
network, measure there with the Python library’s observe mode (sulci
1.5.0 or later: Cache(observe=True) or
sulci-proxy --observe, section 3.11; a run from 1.6.0 or
later also carries its exact-repeat counts), rate the samples there,
then write a summary with
sulci-observe summary … --out run.json and import the file
here. It holds numbers only: no questions, no answers, no hashes. The
browser checks the file before sending it, and Sulci refuses the whole
file if anything in it is unexpected. A run opens as the same report and
printed report, with your own embedder, backend and sulci version named;
there is no review and no judge, because the text never left your
network. Up to 20 runs are kept until you delete them.
What is stored. For a key in observe mode Sulci keeps, besides numbers, up to 400 review samples per key (the question, the cached answer and your model’s answer), encrypted, so you can rate them. They are deleted 14 days after you switch observe mode off (at most 28 days after they were written), when you clear your cache or erase a user, and with your account. Imported runs hold numbers only (section 6.1).
/billing hands you off to a secure Stripe-hosted portal
for everything money-related: invoices and invoice PDFs, payment-method
updates, and usage history. The page also has a cancel button:
cancelling is scheduled for the end of your billing period, and you keep
your plan until then. Sulci’s dashboard never stores your payment
details. Plan changes between Pro and Business don’t need the
portal — use the in-app button on the Overview (Chapter 5 covers the
mechanics).
| Question | Where |
|---|---|
| Is my cache actually working? | Overview — stat cards move within ~1 minute of your first call. |
| I lost my API key | /keys — raw keys are never re-shown; issue a new
one. |
| Hits feel wrong (too few / wrong answers) | The threshold — /settings for every client that doesn’t
send one (including Python on sulci 0.10.1+ with no
threshold= set), in code where you set one. See Chapter 3
§3.3. |
| What has my SDK been reporting? | /audit. |
| How much would Sulci save us? | /savings-preview: switch a trial key to observe mode,
send traffic, rate samples, read the report (section 4.5). |
| Set up chat completions | /settings › Chat completions: provider key, switch,
keys (section 4.4). |
| Change plan | Overview → Subscription panel (in-app, prorated). |
| Upgrade from OSS-Connect | Use the upgrade buttons on your Overview (Stripe Checkout). |
| Cancel | /billing → Cancel. Takes effect at the end of the
billing period; you keep OSS-Connect visibility afterwards. |
| Delete my cached data | From your code: cache.clear() for everything,
cache.delete_user(user_id) for one end-user (any backend).
Over HTTP, DELETE /v1/cache/user/{id} — Chapter 3
§3.2. |
| OSS-Connect | Pro | Business | Enterprise | |
|---|---|---|---|---|
| Price | $0 forever | $29/mo + overage | $149/mo + overage | Sales-led |
| Availability | Self-serve | Self-serve, with trial | Self-serve, with trial | Sales-led |
| Cache runs on | Your infrastructure, plus a small managed allowance | Sulci managed | Sulci managed | Sulci managed (your VPC: planned) |
| Included requests | 10,000/mo managed gateway (hard cap); self-hosted telemetry is not capped | 2,000,000/mo | 20,000,000/mo | Custom (100,000,000/mo default) |
| Overage | — (hard cap) | $0.000015/req | $0.000010/req | Custom |
| API keys | 1 | Up to 5 | Up to 25 | Up to 100 |
| Dashboard | Visibility (trends, deployments, request meters) | Full | Full + deeper analytics (90-day window) | Full + Enterprise surfaces (coming) |
| Settings editor, context window on managed, top queries | — | ✓ | ✓ | ✓ |
Enterprise is arranged with us directly: book a 30-minute call at sulci.io/book-demo, or email
demo@sulci.io.
OSS-Connect is genuinely free and genuinely useful — it exists so self-hosters get visibility without a card, and so a developer in any language can reach a first managed cache hit. The paid tiers are for teams that want the cache itself operated for them.
Self-serve. Choose Pro or Business on the signup form, or upgrade from your Overview; both go through Stripe Checkout.
| Feature | OSS-Connect | Pro | Business | Enterprise |
|---|---|---|---|---|
| Semantic caching (self-hosted, all 6 backends) | ✓ | ✓ | ✓ | ✓ |
Managed cache (backend="sulci") |
10,000 req/mo | ✓ | ✓ | ✓ |
| Context window setting on managed | — | ✓ | ✓ | ✓ |
| Dashboard: hit rate, trends, deployments | ✓ | ✓ | ✓ | ✓ |
| Dashboard: Cost Saved card | ✓ | ✓ | ✓ | ✓ |
| Dashboard: Avg Latency card | — | ✓ | ✓ | ✓ |
| Analytics window | 30 days | 30 days | 90 days | 90 days |
| Top Queries (true served-hit counts) | — | ✓ | ✓ | ✓ |
| Audit workbench (sort/filter/share) | ✓ | ✓ | ✓ | ✓ |
| Settings editor (threshold, context window, context threshold, cost per call) | — | ✓ | ✓ | ✓ |
| Multiple API keys + rotation | — | up to 5 | up to 25 | up to 100 |
Chat completions (/v1/chat/completions, your own
provider key) |
— | ✓ | ✓ | ✓ |
| Savings preview (observe mode on the cache routes, report, review, self-hosted runs) | ✓ | ✓ | ✓ | ✓ |
| Savings preview: the judge, and observe mode on chat completions | — | ✓ | ✓ | ✓ |
| In-app plan change (prorated) | — | ✓ | ✓ | — |
GDPR deletion APIs (cache.clear() and
cache.delete_user() on every backend;
DELETE /v1/cache/user/{id} over HTTP) |
✓ | ✓ | ✓ | ✓ |
| Team management · tenant-wide audit log | — | — | roadmap | roadmap |
| SSO / SAML | — | — | — | roadmap |
| Runs entirely in your VPC | self-hosted only | — | — | planned |
| 14-day / 50k-request trial (one per account) | n/a | ✓ | ✓ | sales-led |
Pro and Business start with a trial: 14 days or 50,000 requests, whichever comes first. A card is required at checkout, but you aren’t charged until the trial ends. The dashboard’s trial banner counts down both dimensions, and we email you when you have used 80% and 90% of the trial’s requests.
When either limit is reached, your subscription begins billing on the spot. If you cancel before that, you pay nothing. There’s no degraded “trial mode” — the trial is the full product.
One trial per account. An account that has already had a trial — through a paid signup or an earlier upgrade — goes straight to a paid subscription on its next upgrade.
/billing → Cancel. The
cancellation is scheduled for the end of your billing period and you
keep your plan until then; after that you drop to OSS-Connect — your
dashboard login, account, and telemetry visibility all survive; only the
managed cache beyond the free allowance and the paid features end.
OSS-Connect holds one key, so revoke any extra keys first — cancelling
with more than one active key is refused with a message saying so.Every cache.get and cache.set against the
managed gateway counts one request, hit or miss. A miss
therefore costs two requests — the lookup that missed and the
set that stores the fresh answer — while a hit costs one.
Your included quota covers the month; usage past it bills at your plan’s
overage rate. The Plan Usage bar on the Overview tracks where you stand,
and the Monthly Requests card is the same number the billing meter
sees.
Things that deliberately don’t count against quota:
data-deletion calls (cache.clear() and the managed per-user
delete always work, even over cap), dashboard reads, and the library’s
telemetry batches.
Two different 429s, two different fixes:
rate_limit_exceeded — you’re sending
too fast right now. The cache endpoints allow 100 requests per 10
seconds per source address. Back off per the Retry-After
header; it clears in seconds.quota_exceeded — you’ve used your
monthly allotment. On OSS-Connect that is the hard 10,000-request cap on
managed calls; paid plans bill overage instead of refusing. It carries
no Retry-After: it resets at the month boundary, or
upgrade.All invoices live in the Stripe portal (/billing →
Manage subscription): downloadable PDFs, line items showing base price
and metered overage, and your payment history. Update cards, billing
emails, and tax details in the same place.
Sulci is built so you can send sensitive traffic through it. This chapter states exactly what crosses each boundary — these are architectural guarantees enforced in code, not policies enforced by promises.
Self-hosted (OSS-Connect): Sulci never receives your
queries, responses or embeddings — the cache runs in your process
against storage you choose. The only thing that reaches Sulci is the
telemetry described below. (If you also use the free managed allowance
with backend="sulci", those particular calls are managed
calls — next paragraph.)
Other network traffic depends on your setup, and none of it goes to Sulci:
embedding_model="openai" sends query text to
OpenAI.HF_HUB_OFFLINE=1 is
set (download the model first).ANONYMIZED_TELEMETRY=False is set.Managed (Pro/Business, and OSS-Connect’s managed
allowance): your queries and responses are stored in the
managed vector store so they can be cached — that’s the product. They
live in the data layer only; they are never copied into the operational
database, the dashboard, or anything a Sulci team member can browse.
Entries are scoped to your account and, when your client sends a
user_id, to that user; conversation histories are scoped
the same way. When your app supplies them (library 1.1.0, section 3.2),
an entry also holds two integers — the input and output token counts of
the LLM call that produced the answer — and the per-day and per-month
totals of those counts are kept with your other usage figures, for your
Tokens Saved card. They are numbers only, never content.
Two features you switch on keep something more, and only for you:
cache.clear() and cache.delete_user(), and
with your account. If you run the judge, it sends
samples to your model provider on your own saved provider key, under
your provider’s terms. A self-hosted run you import
(run.json) holds numbers only: no questions, no answers, no
hashes.Enterprise: an option to run the entire managed stack inside your VPC, so that nothing crosses into Sulci’s infrastructure, is planned and not yet available. Until then Enterprise runs on the managed tier described above.
The library’s dashboard telemetry carries a strict, fixed set of eight aggregate fields per batch: the event type, the backend, counts of hits and misses, average latency, SDK version, Python version, and an anonymous deployment fingerprint. The gateway rejects any batch carrying anything beyond that allowlist; the schema makes it impossible for query text, prompts, responses, or user data to ride along, even by accident, even from a buggy client.
The deployment fingerprint is a one-way hash of a random identifier generated on your machine together with your cache configuration. It lets your dashboard count distinct deployments; it cannot identify a machine, a person, or a customer.
Telemetry is on by default when you pass api_key= or set
SULCI_API_KEY (it’s what powers your dashboard) and fully
optional: Cache(..., telemetry=False) turns it off.
Sulci operators have an internal console for running the platform — investigating billing failures, rotating compromised keys, suspending abuse. Its limits are worth knowing:
The summary worth remembering: anything you don’t see on your dashboard, Sulci’s operator tools don’t show either.
API keys are stored only as cryptographic hashes — the raw key is shown once at creation and is unrecoverable afterward (that’s why losing one means issuing a new one, not “resetting” it). One copy is kept outside that, by design: a key you link to your dashboard is held server-side by our authentication provider (Clerk, a listed sub-processor), so the dashboard can call the API for you. It never reaches your browser, and revoking the key ends its use there too. Revoking or rotating a key takes effect on that key’s next request. Only if the authentication cache cannot be cleared at that moment can a revoked key keep working, for at most five minutes — so for an actively compromised key, rotate immediately and confirm the old key is refused.
cache.clear() wipes every entry on your account, on any
backend — an immediate, real deletion of the stored content and of
conversation histories, and on the managed tier of observe mode’s review
samples — and it works regardless of quota or trial state. On the
managed tier it raises an error if the deletion could not be confirmed
rather than returning as if it had worked. To wipe one
end-user’s entries and conversation history, call
cache.delete_user(user_id) (any backend, sulci 0.10.0+,
with personalized=True); it returns the counts deleted. On
the managed tier it calls DELETE /v1/cache/user/{user_id},
which any language can call directly; that answers
503 erasure_incomplete if it could not finish (repeat the
call — the library raises SulciErasureError in that case)
(Chapter 3 §3.2). Cancelling your plan deletes nothing: the account
continues on OSS-Connect. Run clear() first if you want
your cached data gone. To end the account itself, ask
support@sulci.io in writing for Account
Closure (no paid plan may be active). On the Closure Date every
API key is revoked and processing stops. Permanent
Deletion follows 14 days later, and in any case within 30 days:
it removes your account details and login, telemetry, top queries and
usage totals, and any cache entries still present. Until then a closure
made in error can be reversed. Retrieve your analytics and invoices
before closing; cache entries are not exported. A few Retained
Records are kept because the law or the contract requires them:
billing records at our payment processor, the record of your acceptance
of the terms, a minimal record that the deletion took place, and the
admin audit trail. Each is kept for the period stated in the Privacy
Policy.
Section 6.1 says what Sulci sees. This section says who can be served whose answers. Sulci isolates at three levels, and each one is a choice your code makes:
| Level | What is kept apart | How you get it | What is still shared |
|---|---|---|---|
| Account (tenant) | Everything: entries, conversation histories, settings, usage | Managed: one Sulci account per tenant.
Self-hosted: pass tenant_id on every
call |
Every API key on one account reads and writes the same cache. Keys are credentials, not partitions |
| Customer (user) | Cached answers and conversation histories | Cache(personalized=True) and the customer’s id as
user_id |
Calls without a user_id use the account’s shared area,
and a call with one never sees it |
| Conversation (session) | The history that a follow-up’s lookup blends | session_id on every turn of one conversation |
Stored entries. There is no conversation-private cache; see below |
A worked example: a customer-support chatbot. Your bot answers questions for many customers of yours.
user_id.personalized=True and pass that customer’s id as
user_id. Alice’s repeat then hits her own entry, and Bob’s
identical question misses, because her answer is not his.session_id: the lookup blends the conversation’s recent
turns (section 3.4), and since sulci 1.1.1 an answer to a follow-up is
recorded in that conversation but not stored as an
entry anyone else could be served. A follow-up you have
rewritten to stand on its own can opt in with
standalone=True.The figure puts the example on one page. Business A’s bot builds one cache and chooses the scope per question:
cache = Cache(backend="sulci", api_key=SULCI_API_KEY, personalized=True)
# A general question: shared by all of Business A's customers
cache.cached_call(question, ask_llm, session_id=ticket_id)
# An account-specific question: this customer only
cache.cached_call(question, ask_llm, user_id=customer_id, session_id=ticket_id)Pass the id of the end customer as user_id, not
the id of the support agent or the bot. With
personalized=True, a call without a user_id
uses the account’s shared scope, so the same cache serves both kinds of
question.
The Acme sample app (the download on the site’s Documentation page) runs all three. Scenario 03 shares a general answer, and scenario 03b isolates an account-specific one.
What a session is not. A session_id
keeps each conversation’s history separate, and it keeps
context-dependent answers out of the shared cache. It does not create
entries only that conversation can read: a self-contained question asked
in one conversation can be answered from an entry another conversation
stored, within the same account and customer scope. That is what makes
the cache useful across conversations.
One account, several tenants. If you serve several
businesses from one Sulci account, pass the business’s id as
user_id (answers are shared within each business, never
across them), or "business:customer" (per customer, so less
sharing and fewer hits). Otherwise use one account per business. A
second API key on the same account is not a boundary.
What separate keys are for. Every key on an account reads and writes the same cache, uses the same quota and the same settings. A key is a credential: use separate keys to separate who connects, never whose answers they see. For Business A on Pro (up to 5 keys):
| Key | Example use | Why a separate key helps | Shares answers with the bot? |
|---|---|---|---|
| 1 | The support bot in production | The main workload | — |
| 2 | A second service on the same questions, such as the help-centre widget | Rotate or revoke it without touching the bot; its last seen shows it is alive | Yes, and that is the point: an answer the bot cached serves the widget |
| 3 | A nightly job that asks the top questions so mornings start warm | Cut the job’s access without touching the bot | Yes |
| 4 | A partner’s or contractor’s integration | Revoke it the day the engagement ends | Yes, so give it only to someone allowed to see these answers |
| 5 | A spare: issue it, move the bot to it, revoke the old key | Rotation with no downtime, or a replacement if a key leaks | Yes |
A key per environment does not keep staging apart from production: staging’s test answers would be served in production. Give staging its own Sulci account (section 4.3).
Erasure follows the same levels.
cache.clear() erases the account, and
cache.delete_user(user_id) or
DELETE /v1/cache/user/{user_id} erases one customer, each
with its conversation histories (section 6.5). For one conversation:
self-hosted, cache.clear_context(session_id) drops its
history; on the managed tier, a conversation’s history expires an hour
after its last turn.
Which integrations carry which id. The Python
Cache and the HTTP API (and the TypeScript SDK) carry all
three. sulci-proxy carries a session
(x-sulci-session-id) but no customer id. The LangChain
adapter carries neither, so use the library directly for per-customer
isolation (the Integration Guide, Chapter 6, has the per-integration
detail).
The trade-off to plan for: the narrower the scope, the fewer repeats it sees, so the fewer hits. Share what can be shared, and isolate what must be.
Doesn’t my LLM provider already cache? Provider prompt caching is exact-prefix token discounting; Sulci is semantic deduplication that skips the call entirely. They solve different problems and stack well — Chapter 1 §1.6 has the full comparison.
Will I get stale answers? Only if you cache things
that go stale and let them live too long. Cached answers are frozen at
write time, so the controls are yours: set ttl_seconds to
match how fast each workload’s facts change (a day by default; minutes
for anything volatile), and simply don’t cache calls whose answers
change by the minute. On Sulci Cloud every entry lives 24 hours whatever
ttl_seconds says (Appendix A). Documentation, policies, and
how-to answers — the bulk of repetitive traffic — age slowly.
What if a bad answer gets cached? A wrong or
low-quality LLM response, once cached, gets re-served — so the levers
are: keep TTLs short while you’re iterating on prompts, raise the
threshold if loose matches are pairing questions with the wrong stored
answers, partition by user_id where answers are
user-specific, and cache.clear() to flush wholesale after a
prompt or model change that invalidates old answers.
Do cache hits count against my monthly quota? Yes —
every get and set against the managed gateway
is one metered request, hit or miss, so a hit costs one request and a
miss costs two (the lookup and the set that stores the
answer). The economics still work because a Sulci request costs a
fraction of a cent at most, while the LLM call a hit replaces typically
costs far more, plus seconds of latency. The Cost Saved card shows the
estimated LLM spend avoided; compare it with your bill.
What happens if Sulci has an outage? Your app keeps working. Cache reads are fail-soft by contract: any server-side failure returns a miss, not an error, and your code proceeds to the LLM as if the cache were cold. An outage costs you savings, never uptime.
Does Sulci see my prompts and responses? Self-hosted: no — Sulci receives only aggregate telemetry, and you can turn even that off. (Your own setup can send data elsewhere — the OpenAI embedder sends query text to OpenAI, and a hosted vector database holds your entries.) Managed: your queries and responses are stored so they can be cached, but they live only in the content store — no dashboard, operator tool, or telemetry path can read them. The exception you choose: a key in observe mode keeps encrypted review samples for you to rate in your own dashboard (section 6.1). Chapter 6 covers the enforcement.
Can I use Sulci with streaming responses? Yes, with
one adjustment: Sulci stores complete responses. On a miss, stream from
your provider as usual and set() the assembled text; on a
hit, you have the full answer in tens of milliseconds — return it
directly (or chunk it client-side if your UI expects a stream). Users
experience hits as instant, which beats any stream.
I use several models/providers — does that work?
Sulci is provider-agnostic: it never calls your LLM, you do, so it works
with any provider, model, or mix. One caution: if different models
produce materially different answers for the same question, keep a
separate Cache instance (or partition) per model rather
than letting them share entries.
What’s the overhead on a cache miss? The lookup
before your LLM call proceeds — embedding dominates it, and our measured
hit latency on the shipped embedder is 87ms p50 on one machine
(environment-dependent; yours will differ). Against a multi-second LLM
call that is small; the latency is visible per-request in the
cached_call result so you can measure it on your own
traffic.
My team isn’t (all) Python — options? The library is
Python. TypeScript has an official client, @sulci/sulci
(Chapter 3 §3.9), and the managed gateway is a plain HTTPS API
(POST /v1/cache/get / /v1/cache/set with your
key in X-Sulci-Key) that any language can call directly —
including on the free OSS-Connect allowance.
What exactly happens when my trial ends? Nothing visible: the 14-day-or-50k boundary simply starts billing on the card you saved at checkout — no interruption, no feature change. Cancel before the boundary and you pay nothing and keep OSS-Connect visibility. (Trials apply to self-serve Pro and Business.)
How fast does Sulci pay for itself? Hit rate × your
per-call LLM cost × volume, minus your Sulci bill. The hit rate is the
unknown, and it is a property of your traffic, not of Sulci: measure it
before you serve a single cached answer. On Sulci Cloud, Savings
preview (section 4.5) runs a key in observe mode on your real
traffic and reports the hit rate, the savings at your prices, how often
a would-be hit was wrong (from samples you rate) and a draft verdict;
with the library, Cache(observe=True) measures the same
inside your own network (section 3.11).
Organized by symptom. The first section covers the report we see most.
A. Everything is zero, including the trial/requests
counter. Your calls aren’t reaching the gateway at all. Check:
is SULCI_API_KEY the live key (not a stale paste)? Can your
network reach api.sulci.io (some corporate proxies block
it)? The Python library treats every gateway error on a lookup as a
miss, so a bad key shows up as all misses in cache.stats()
rather than as an exception — call the API directly to see the
invalid_key error:
curl -s -X POST https://api.sulci.io/v1/cache/get -H "X-Sulci-Key: $SULCI_API_KEY" -H "Content-Type: application/json" -d '{"query": "ping"}'A working key answers 200 with the lookup result
("cache_hit": false unless ping is cached); a
bad one answers 401 with invalid_key.
B. The requests counter moves, but Cost Saved / Hit Rate stay zero. Your calls are arriving; the usage pipeline behind the stat cards is delayed on the server side. Nothing on your end fixes this — open a support ticket with your key prefix.
C. Stat cards work, but the trend chart and Recent Activity
are empty. Telemetry isn’t arriving. Either you passed
telemetry=False, or you’re on a pre-0.7.0 library, where
dashboard telemetry required a separate opt-in — upgrade with
pip install -U sulci. The panels populate within ~30
seconds of your next call. Recent Activity shows batches reported under
the key your dashboard is linked to, so a process using a different key
of yours won’t appear there.
D. Tokens Saved shows a dash, or covers fewer hits than you
have. The card counts only managed hits on answers that were
stored with token counts. Pass them when you store an answer —
sulci.with_usage(...) from your cached_call
function, or set(..., usage=...) — on
sulci>=1.1.0 (section 3.2). From 1.3.0,
sulci.llm’s helpers, sulci-proxy and the
LiteLLM adapter report them for you; a streamed call, a tool call or
more than one choice still adds nothing. Answers already in the cache
keep no counts; the figure fills in as new answers are stored with them
and then hit. Self-hosted hits never count.
zsh: no matches found: sulci[sqlite] —
quote it: pip install "sulci[sqlite]".ModuleNotFoundError: sentence_transformers
— you installed without a backend extra. Either
pip install "sulci[sqlite]", or — if you only use the
managed backend — plain pip install sulci works and the
gateway does the embedding for you.pip install sulci).backend="sqlite" (pure Python) or
backend="sulci" (no local deps), or install VS Build
Tools.Every lookup is a miss, even a question asked word for word a minute ago — the cache is not reaching you, and the Python library won’t say so: it treats any error on a lookup as a miss, and drops a failed store silently, so your app keeps working. Check, in this order:
401 invalid_key:
a stale paste or a revoked key (section 7.1 A).429 quota_exceeded (OSS-Connect: 10,000 managed requests a
month), or 429 rate_limit_exceeded for a moment (section
7.4).api.sulci.io:443.One call shows which: the status line, and the
x-sulci-observe header that only a key in observe mode
gets.
curl -si -X POST https://api.sulci.io/v1/cache/get -H "X-Sulci-Key: $SULCI_API_KEY" -H "Content-Type: application/json" -d '{"query": "ping"}' | grep -iE '^HTTP|^x-sulci-observe'A 200 with no x-sulci-observe line means
lookups on this key are served from the cache; if they still miss, look
at the threshold (the next item). The sample app,
acme-support-bot.zip on the Documentation page, runs the
same check as python demo.py --check-key and says what to
do.
Hit rate ~0% despite obvious paraphrases —
threshold too high (self-hosted, an unset threshold means 0.85; on the
managed tier it means your dashboard setting), or you’re constructing a
fresh Cache (with a fresh empty store) on every request
instead of reusing one. Lower the threshold temporarily and inspect what
hits.
Wrong/surprising answers — threshold too low, or
per-user content without personalized=True, or context mode
blending across what should be separate sessions (check your
session_ids).
ValueError after upgrading to 0.9.3 or
later — you passed "global" or an empty string as
a tenant_id or user_id, or a reserved key in
metadata. Map empty ids to None; rename the
metadata key (Chapter 3 §3.2).
TypeError naming tenant_id
after upgrading to 1.0.1 — you passed a tenant_id
on the managed backend (backend="sulci"). It never
partitioned anything there: your Sulci account is that backend’s only
partition, and every API key on the account shares its cache. Remove the
argument, and give each tenant its own Sulci account if they must not
share answers — or, on one account, use personalized=True
with the tenant as user_id (Chapter 3 §3.2).
stats() disagrees with the
dashboard — stats() is per-process and
since-construction; the dashboard is account-wide and calendar-month.
Both are right.
Context mode hits less than stateless did —
expected; blended vectors score lower. Set and calibrate
context_threshold rather than lowering
threshold for every lookup (Chapter 3 §3.4).
Follow-up questions are never cached in a
session — by design, on the managed tier and in the library
since 1.1.1: a set inside a session that already has a turn
records the turn but stores no entry unless standalone=True
(Chapter 3 §3.4).
More (or looser) managed hits after upgrading to
0.10.1 — expected if you never set a threshold: the Python
Cache used to send 0.85 on every lookup and now sends none,
so your dashboard’s Threshold (0.65 unless you changed it) applies. Pass
threshold=0.85 to keep the old comparison, or set the value
you want in /settings.
| Error | Meaning | Fix |
|---|---|---|
401 missing_key / 401 invalid_key |
No key sent, or key unknown or revoked | Send X-Sulci-Key; check the key |
402 suspended |
Account suspended | Contact support |
403 plan_required |
Endpoint needs a higher plan (keys, settings, billing, top queries) | Upgrade, or drop the feature |
402 self_serve_billing_closed |
Paid self-serve signup/upgrade is temporarily switched off | Retry later, or email support@sulci.io |
413 payload_too_large |
Request body over 1 MiB on /v1/cache/get or
/v1/cache/set |
Send less; do not retry the same body |
422 validation_error |
Request body failed validation — e.g. a reserved or empty id, an id
over 256 characters, a query over 8,192 characters, a response over
262,144 characters, metadata over 16,384 bytes or with a
reserved key, a null setting, or text that is not valid
Unicode |
Fix the request; the error names the field, never echoes your input |
429 rate_limit_exceeded |
Too fast right now | Back off per Retry-After |
429 quota_exceeded |
Monthly cap reached | Wait for month boundary or upgrade |
503 erasure_incomplete |
A deletion did not finish | Repeat the call |
Could not reach api.sulci.io |
Network path | Proxy/firewall allowlist api.sulci.io:443 |
Cache reads are deliberately fail-soft: if anything breaks
server-side, cache/get returns a miss rather than an error,
and the Python library also treats a failed lookup as a miss — an outage
costs you cache savings, never uptime. Deletions are the exception: they
report failure, because a deletion you believe happened and didn’t is
worse than an error.
Email support@sulci.io with your key
prefix (the sk-sulci-XXXX… shown on
/keys — never send the full key), what you observed, and a
timestamp. Situations that are always server-side: symptom B above, a
/welcome page stuck beyond a minute during signup, and any
mismatch between your dashboard plan label and Stripe.
Threshold — The 0-to-1 similarity cutoff deciding hit vs miss for a lookup with no conversation history. Unset, the Python library uses 0.85 on a self-hosted backend; on the managed tier a lookup that sends none uses your tenant setting, which defaults to 0.65.
Context threshold — The cutoff for a lookup that blended conversation history; stricter than the threshold because a blended lookup sits closer to every answer on its topic. Managed default 0.80; the library ships none.
Hit / Miss — A hit returns a stored answer (similarity ≥ threshold); a miss means you proceed to the LLM. Hit rate = hits ÷ (hits + misses).
Context window — How many past turns of a session are blended into each lookup. 0 = stateless. Managed default 2; self-hosted default 0.
Session — A conversation identified by your
session_id; the unit of context blending. Idle sessions
expire after an hour by default.
TTL — Time-to-live: how long a cached entry remains servable before automatic expiry.
Anchor key — The API key created at signup, which links your dashboard login to your account; can be rotated but not directly revoked.
Key prefix — The first characters of a key
(sk-sulci-XXXX…), safe to share in support tickets; the raw
key is shown only once.
Telemetry — The aggregate-only batches (counts,
latency, SDK version, anonymous fingerprint) that power your dashboard.
Never contains queries or responses. Opt out with
telemetry=False.
Deployment fingerprint — An anonymous machine hash letting the dashboard count distinct deployments. Identifies nothing.
OSS-Connect — The free tier: self-hosted cache + dashboard visibility, plus 10,000 managed-gateway requests a month.
Overage — Per-request billing past your plan’s included monthly quota.
Trial tripwire — The 14-day-or-50k boundary that ends a Pro/Business trial and starts billing. One trial per account.
Observe mode — A setting on a Sulci key (Savings
preview), or Cache(observe=True) in the library, under
which nothing is served from the cache: every lookup runs and is turned
away, and what the cache would have served is recorded.
Would-be hit — In observe mode, a call whose closest cached question scored at or above your threshold: the call the cache would have answered.
Review sample — A would-be hit kept for rating: the question, the answer the cache would have served and your model’s answer. Rated Acceptable, Not acceptable or Can’t tell.
Wrong-hit bound — The 95% upper bound (Wilson score interval) on the share of would-be hits that were not acceptable, from the samples rated.
Savings preview — The dashboard page (every plan; the judge on Pro and above) that runs observe mode on your keys, reports the hit rate, savings at your prices and the wrong-hit bound with a draft verdict, and imports self-hosted runs.
run.json — The summary
sulci-observe summary writes after a self-hosted observe
run: numbers only, no text and no hashes, for import into Savings
preview.
Chat completions — Sulci’s OpenAI-compatible route
(POST /v1/chat/completions, Pro and above): Sulci answers
from the cache on a hit and calls your model provider, on your saved
provider key, on a miss.
This appendix lists every setting the sulci library
(1.3.0) and Sulci Cloud read: where you set it, its default on a
self-hosted backend, its default on Sulci Cloud
(backend="sulci"), and which value wins when it is set in
more than one place. Other chapters link here instead of restating
defaults.
On Sulci Cloud (backend="sulci"), the
gateway resolves each lookup’s settings in this order:
| Setting | 1st | 2nd | 3rd | Default |
|---|---|---|---|---|
threshold |
the request’s threshold |
your Threshold setting | — | 0.65 |
context_window |
the request’s context_window |
your Context window setting | — | 2 |
context_threshold (a lookup that blended history) |
the request’s context_threshold |
the request’s threshold |
your Context threshold setting | 0.80 |
The Python library sends a value only when you set one. Leave it
unset and your dashboard setting applies, then the default. A value you
set in code — 0 included — is sent and beats the dashboard.
The exceptions: an instance context_threshold is not sent
when the call passes its own threshold, and a
context_window outside 0–20 is capped or dropped (A.2).
On a self-hosted backend, the library decides alone:
| Setting | 1st | 2nd | Default |
|---|---|---|---|
threshold |
per call (get / cached_call) |
Cache(threshold=…) |
0.85 |
context_threshold (a lookup that blended history) |
per-call context_threshold, then per-call
threshold |
Cache(context_threshold=…), then
Cache(threshold=…) |
0.85 (with a one-time warning when nothing was set for a blended lookup) |
context_window |
Cache(context_window=…) or
cache.context_window = … |
— | 0 (stateless); with a session_store=
and no window, the last 6 turns |
There is no per-call context_window in the library.
“All defaults” means unset.
Cache(context_window=None)andCache()are the same everywhere.Cache(context_window=0)is not: on Sulci Cloud it sends 0 and turns off your account’s default window of 2.
Cache(...)| Setting | Self-hosted default | Sulci Cloud | Notes |
|---|---|---|---|
backend |
"chroma" |
"sulci" |
Also accepts a backend instance (0.6.0+). The LangChain and
LlamaIndex adapters pass it through, so their default is
"chroma" too. |
threshold |
None → 0.85 |
None → nothing sent → your setting →
0.65 |
0.0–1.0. A lookup that blended history uses
context_threshold when one applies (A.1). |
embedding_model |
"minilm" |
not used: the gateway embeds | "openai" sends query text to OpenAI to embed it. |
ttl_seconds |
86400 (24 h); None or 0 = no
expiry |
sent but not honoured: every entry lives 24 h | |
personalized |
False |
False |
True partitions entries by user_id; on
Sulci Cloud user_id is sent only when it is
True. |
db_path |
"./sulci_db" |
not used | Local backends only. |
context_window |
None → 0 (stateless) |
None → nothing sent → your setting →
2 |
0–20 on Sulci Cloud: the library sends at most 20 (a larger whole
number goes as 20, with a one-time warning), and sends nothing for a
negative or non-whole value; the HTTP API refuses more than 20.
Self-hosted with no session_store, a Cache
keeps no sessions until this is above 0; with a
session_store= and this unset or 0, it blends the last 6
turns. |
query_weight |
0.70 |
0.70, fixed | Weight of the current query in a blended lookup. |
context_decay |
0.50 |
0.50, fixed | Older turns weigh less: 1, 0.5, 0.25… |
session_ttl |
3600 |
not sent: sessions end 1 h after their last turn | Applies only to the built-in session store. A
session_store= you pass keeps its own expiry
(RedisSessionStore(..., ttl_seconds=None) never
expires). |
context_threshold |
None → the lookup’s threshold (warns
once) |
None → the call’s threshold if it sent one
→ your setting → 0.80 |
0.0–1.0; only a lookup that blended history uses it. |
telemetry |
True |
True |
With an API key, sends only aggregate counts and timings, never queries or answers. |
api_key |
None → SULCI_API_KEY |
required | |
gateway_url |
"" → https://api.sulci.io |
same | An environment variable can also set it; see the library’s README. |
session_store |
None (built-in, in-process) |
not used: the gateway keeps sessions (last 20 turns) | |
event_sink |
None |
None |
|
cost_per_call |
0.005 |
0.005 |
Used for the cost estimate only. |
observe |
False |
refused (TypeError): use observe mode on the key, in
Savings preview |
1.5.0. True turns every hit away and records what the
cache would have served (section 3.11). |
observe_path |
None → ./sulci_observe.db |
not used | 1.5.0. The observe-mode file (SQLite, created 0600). |
| Method | Settings it takes |
|---|---|
get(query, ...) |
threshold, context_threshold,
user_id, session_id, tenant_id,
plan; self-hosted only (1.4.0): variant,
accept, record_hit |
set(query, response, ...) |
user_id, session_id,
metadata, standalone, usage,
tenant_id, plan; self-hosted only (1.4.0):
variant |
cached_call(query, llm_fn, ...) |
threshold, context_threshold,
standalone, user_id, session_id,
cost_per_call, tenant_id, plan,
and **llm_kwargs for llm_fn |
AsyncCache’s aget, aset and
acached_call take the same settings, except that
acached_call passes no **llm_kwargs. Their
first few parameters are positional and in a different order, so pass
settings by name.
standalone=True stores an answer that
does not depend on the conversation, even inside a session. It affects
storing only; the lookup still blends history.usage carries the call’s token counts
for Tokens Saved (Sulci Cloud only). llm.anthropic /
llm.openai / llm.gemini (1.3.0) send it for
you.variant (1.4.0, Qdrant only) keeps
answers that depend on more than the question apart:
get(..., variant=v) returns only entries stored with
set(..., variant=v), and a plain get never
returns an entry stored with a variant. On Qdrant with strict mode on,
create a keyword payload index on sulci_variant before
upgrading to 1.4.0.accept (1.4.0) is your
callable(response, similarity) -> bool, run on a
candidate hit before it is recorded; False makes the call a
miss everywhere.record_hit=False (1.4.0) returns a hit
without recording it as the session’s newest turn.On Sulci Cloud the last three are refused with
TypeError: the gateway decides there.
Set in the dashboard (Pro and above) or with
PATCH /v1/settings:
| Setting | Default | Range |
|---|---|---|
| Threshold | 0.65 | 0.0–1.0 |
| Context window | 2 | 0–20 |
| Context threshold | 0.80 | 0.0–1.0 |
Cost per call (cost_per_call_cents, in hundredths of a
cent) |
50 ($0.005) | 0 or more; used only for the Cost Saved estimate |
Fixed on Sulci Cloud, not settable: entries live 24 hours; a session
keeps its last 20 turns and ends an hour after its last one;
query_weight 0.70 and context_decay 0.50.
sulci-proxy and sulci-mcp take
--context-window: unset, it is 4 on a
local backend and nothing is sent with --backend sulci
(your setting applies, default 2). --ttl-seconds defaults
to the library’s 86400 and is not honoured with
--backend sulci.
sulci-proxy --observe (1.5.0, self-hosted backends)
answers every call from upstream and records what the cache would have
served, to --observe-path (default
./sulci_observe.db); each response carries
x-sulci-observe. sulci-observe (1.5.0; also
python -m sulci.observe) reads that file:
status, rate, export-pairs,
import-ratings, report, summary
(writes run.json) and forget (section
3.11).