Repository navigation
BV-SALA 1.2.5 — fixes from an end-to-end test of the 1.2.4 package, run like a new user
LatestWe installed the 1.2.4 tarball in clean projects and followed every README and guide
block literally, with no key and local stand-in providers. The free mode saved as
promised and nothing reached BiVelio without a key. What follows is what did not
match the docs. No saving lever changed: what is sent to the provider, the caches,
the trimming and what a valid key unlocks behave as in 1.2.4.
Fixed
- Python:
wrap()warns when a proxy would carry the gateway traffic. The
copy thatGateway.wrap()returns shares the original client's HTTP client, as
in 1.2.4, and that client reads the proxy settings. WithHTTP_PROXYor
ALL_PROXYset (HTTPS_PROXYfor anhttps://gateway) and the gateway's host
not inNO_PROXY, requests to the local gateway go through the proxy, provider
API key and prompt included.wrap()now emits aUserWarning, once per gateway
URL, that names the variable (nothing of its value) and says to set
NO_PROXY=127.0.0.1,localhostbefore creating the client. Nothing else in
wrap()changes. The Python README used to say the client ignores proxy
settings, which is true only for the package's own calls (status and reports). - Python: error messages give a command that works after
pip install.
GatewayUnavailableandGatewayMismatchnow say
npx @bivelio/savings-layer gatewayinstead ofbvsala gateway, which is not on
the PATH of a pip user. - A provider that cuts a streamed answer is reported as the guide says. The
gateway log reads→ 200 (stream) · not metered: the provider cut the answer before its final usage · detail: <transport error>, and the local report carries
the same reason. The client still sees the cut and can retry. A cut that comes
after the provider's final usage (the whole answer arrived, then the connection
broke) is now metered with that usage, as when the client closes at that point:
the log saysthe provider closed the connection after the final usage; metered anyway. - Coalesced duplicates no longer hide the call that was paid. With
BVSALA_GATEWAY_COALESCE=1, a report looked up by the provider's response id
(?response_id=, which Python'sgw.report(resp)uses) now returns the request
that called the provider, with its real cost, instead of "call avoided" at $0.
Each duplicate's own report is still available by itsx-bvsala-request-id. - In
bvsala gateway, placeholder service keys are rejected before any network
call.BIVELIO_SERVICE_KEY='bvk_...',bvk_xxx,bvk_<your key>,
bvk_YOUR_KEYand similar values get the "does not look like a service key"
message and the free exit; nothing is sent to savings.bivelio.com. A placeholder
BIVELIO_SERVICE_KEYnow stops the start even when an offline
BIVELIO_LICENSE_KEYis set (1.2.4 started offline when savings.bivelio.com could
not be reached): unset it. - Startup and exit texts of
bvsala gateway. The banner says COMMUNITY MODE
once.BVSALA_GATEWAY_COALESCE=1prints a startup line, and
BVSALA_GATEWAY_SHADOW=1withoutBIVELIO_SERVICE_KEYsays it is ignored (also in
--help). A malformedBIVELIO_LICENSE_KEYwith no service key points to the free
COMMUNITY exit instead of promising online collection. With
BVSALA_GATEWAY_ELISION=0a $0 summary blames that switch, not the TTL rule, and
names what it turns off (cache TTL tuning, sibling model, effort ceiling, context
elision dials; not coalescing).
Amounts below one cent keep six decimals ($0.000044, not$0.0000). bvsala initfor the framework adapters says identical requests in flight are
shared unless that one is a stream, as the README does.- Python test suite passes with anthropic 2.x, which sends the key as
Authorization: Bearerinstead ofx-api-key.
Documentation
- The first README example runs when pasted on its own. The TypeScript block
under "Install anywhere, in 60 seconds" carries its ownimportline; before, it
failed withReferenceError: OpenAICompatibleProvider is not defined. The repo now
compiles every README block that starts with animporton its own and runs the
quickstart block from the packed tarball. - OpenAI-compatible upstreams keep their provider's path. The gateway forwards
the path your client sends to the provider's bare origin, so the base URL is the
provider's own withhttp://127.0.0.1:<port>as host:/v1for openai, moonshot,
minimax, ollama, vllm and lmstudio; no path for deepseek;/compatible-mode/v1
for qwen;/api/paas/v4for glm;/v1beta/openaifor gemini;/api/v1for
openrouter. The README,bvsala doctor, the Cursor guide and docs/terminales say
the same (one table, checked by a test). Cline is listed under the Anthropic
gateway, as its guide says. - Simultaneous streamed requests. A stream joins an identical
generate()
already in flight, but nothing joins a stream: identical requests started while a
stream runs are each paid; a repeat after it finished is served from the exact
cache. The Mastra adapter never shares a request in flight. The README now says
so. - "About 0 %" on non-repeating traffic has one exception, now stated. With no
key, on Anthropic, a long system prompt that changes on every request (a
timestamp, a user id), or is reused only after its 5-minute cache expired
(requests more than 5 minutes apart, each in a fresh process), is marked for the
prompt cache every time and costs about 20 % more than no layer. Put what changes
in the user message (then requests within those 5 minutes save), or, in either
case, passmaxCacheBreakpoints: 0toAnthropicProvider.
report.cost.netSavingsRatiois documented as negative when the layer costs more. - Qwen Code: one settings key everywhere. The guide,
bvsala doctorand
bvsala qwensaysecurity.auth.selectedType: "anthropic"in
~/.qwen/settings.json(or--auth-type anthropic), the key current Qwen Code
reads, and that it needsANTHROPIC_MODEL. - Droid, Codex, Gemini and DeepSeek guides. The Droid
customModelsentry
carriesmodelanddisplayName, the same JSONbvsala doctorprints. The Codex
block says a hand-started gateway needs--upstream openai. The Gemini line no
longer shows a fixed port forbvsala gemini. The DeepSeek guide and the $0 exit
summary say its Anthropic endpoint reports no cache writes, so the TTL lever
credits nothing there. - Python README on PyPI. A paragraph that ran together now renders as a list,
every Python block runs on its own, and the README and docstrings say what the
gateway does with no key (it measures on your machine; a key adds the cloud).
WithBVSALA_GATEWAY_COALESCE=1, per-request reports need the raw response, the
stream or thex-bvsala-request-id. - Smaller fixes. A visible line under the first install command says npm needs
--legacy-peer-depson AI SDK 5, LangChain 0.3, Mastra < 1.68 or
@anthropic-ai/sdk< 0.103. TheBVSALA_SEAT_IDexample is anexport. NOTICE
lists "cloud metering" (local metering is free). Thesavings.semanticCachetype
docs namecreateSavingsLayer({ semanticCacheStore })and no longer say a license
is needed. The 1.2.4 entry now sayspython -m bvsala statusprints
metering: onagainst a gateway with no key.
1.2.4 was not published on its own: everything below ships in 1.2.5 too.
Also in this release: 1.2.4 — 2026-11-21 — the free Measure plan saves exactly like no key, paid plans trim Anthropic tool loops, honest texts
Changed: what you will notice after upgrading
- A Measure license now applies the levers. Up to 1.2.3 the free Measure
license ran the SDK and the gateway in shadow mode: every request went to the
provider untouched and nothing was served from cache, so setting the free key
saved less than setting none. From 1.2.4 a layer or a gateway with a Measure
license does exactly what it does with no key: same calls, same request bodies,
same savings in the report, trimming of superseded tool results included. If you run
Measure today, your traffic starts being cached, deduplicated, trimmed and
cache-marked as soon as you upgrade, and the usage sent to your dashboard carries
real savings instead ofshadowrecords. Measure usage is still never billed. To
keep only watching, opt in on any plan:observeOnly: truein the SDK, or
BVSALA_GATEWAY_OBSERVE_ONLY=1in the gateway.
In observe-only modereport.measure.wouldHaveSavedis reported as before, and
submitting a batch throws anError, because a batch is itself a lever. Where a
keyless lever costs more than not using the layer (a system prompt that changes
on every request, for example: +21 % on Anthropic, as in 1.2.3 with no key), a
Measure layer now does too;observeOnly: truekeeps the 1.2.3 behaviour. - Pro, Team and Enterprise licenses trim superseded tool results inside an
Anthropic tool loop. Up to 1.2.3 a paid license did not trim them at all:
trimming of superseded tool results (an old tool result is replaced by a stub
when a newer call re-reads the same resource) asked for a feature that no issued
license carried. With a live paid license (Pro, Team or Enterprise) the SDK now
trims them withAnthropicProviderand the default cache placement, and only
results from the tool loop in progress (after your last user message), which that
placement never marks for caching (elisiontracepartialwhen it keeps an
older one). With a paid license it stays off withcacheBreakpoints: "auto"and
with any provider other thanAnthropicProviderwithoutautomaticCache(Claude
through an OpenAI-compatible endpoint such as OpenRouter or LiteLLM included), as
in 1.2.3 (elisiontraceskipped). This is the only lever a paid license
applies differently from no key in the SDK. The free Measure license has no such
exception and trims exactly as with no key, so a Measure layer never costs more
than a layer with no key. It is decided in the client, so it works with the
license you already have. Opt out per request with
savings: { elision: false }. An expired, revoked or invalid license still fails
closed, as before. - In the gateway, a Measure license applies the levers; paid licenses work as in
1.2.3. With the free Measure licensebvsalaapplies the same levers as with no
keys: cache TTL tuning by default, and sibling model routing, per-turn effort and
the context dials only with their own flags, whatever the entitlements endpoint
answers. With a Pro, Team or Enterprise license nothing changes from 1.2.3: each
lever also needs its feature in your organization's license, checked fail-closed,
so with no service key, an unreachable entitlements endpoint, a 401 or a license
without the feature, requests travel untouched.BVSALA_GATEWAY_ELISION=0still
turns them all off, and a blocked, expired or revoked license still answers 402.
The startup lines say "free Measure license: the same levers as no key" with
Measure, and "ON if your organization's licence includes …; fail-closed" with a
paid license, as in 1.2.3. - With no key and with Measure, trimming of superseded tool results works exactly
as in 1.2.3.
Replacing an old tool result with a stub changes the middle of the history, so on
a provider that caches the whole prompt by itself everything after it is billed
again. Measured with a fake provider, cost against not using the layer, the same
in 1.2.3 and 1.2.4 with no key: on a 60-step agent loop, gpt-5 +12.2 %, Gemini 2.5
Flash +11.9 %, DeepSeek +166 % and Qwen +13 %; on Anthropic with
cacheBreakpoints: "auto", −71.5 % against −84.4 % with trimming off, with
AnthropicProvider({ automaticCache: true }), −69.0 % against −85.2 %, and in a
chat that re-reads the same tool output on every user turn (a 12-turn support chat
on Sonnet 4.5), −30.1 % against −67.2 % with trimming off. Set
savings: { elision: false }there. With a paid license it only acts inside a
tool loop on Anthropic (see above): agent loops on Anthropic go from 0 % to
−71.6 % with Pro, and every other load we measured trims nothing, as in 1.2.3
with a paid key. bvsalashows the money when it exits. The exit summary of the terminal
wrappers adds the spend at list price and the saving by basis (measured, by
reference, estimated). When nothing was saved it says why: on a subscription no
saving is credited, and otherwise which traffic cache TTL tuning is credited on.
When the levers cost more than they saved, it says so and names the variable that
turns them off.- The startup banner says which lever acts. With no keys it no longer prints
"every local saving lever on" above three levers that are OFF: it says that cache
TTL tuning is the only gateway lever on by default, that it only acts on Anthropic
API-key traffic asking for the 1-hour cache, that on a Claude or ChatGPT
subscription the run only measures, and the variable for each opt-in lever.
--help,bvsala doctorandbvsala initsay what a BiVelio key adds: the
cloud, with exactly the same levers as no key under the free Measure license; a
paid license keeps the trimming exception above in the SDK, and in the gateway
works as in 1.2.3. The manual Claude Code line that the gateway prints at startup
andbvsala doctornow starts withENABLE_TOOL_SEARCH=true, as the Claude Code
guide says. bvsala initdescribes what a framework adapter does. For the Vercel AI SDK,
Mastra, LangChain and Anthropic SDK stacks it no longer lists prompt-cache
placement, trimming and compact serialization as on by default, or
observeOnly: trueas the way to only observe: the adapters never rewrite what
your framework sends and have no observe-only mode. It says what they do: exact
repeats, identical requests already in flight (not in Mastra) and the questions
the layer computes locally.bvsala doctorchecks each terminal against its own route. Gemini CLI, Cursor,
Aider, DeepSeek and Ollama name the log line of their own protocol
(:generateContent,/v1/chat/completions, …) instead of inheriting the
/v1/messagescheck, and the report has no Spanish left in it.- Usage ingest answers 503 instead of accepting a batch blind. When the cloud
cannot read your organization's license during ingest, it retries once and then
answers 503 without storing the batch. The SDK and the gateway re-queue a batch
on any 5xx (up to 1,000 records per process; beyond that the oldest are dropped),
so a short outage loses no usage; it arrives on the next flush. - Commission is billed only to organizations on a commission plan. The monthly
billing run now invoices commission only when the organization had a subscription
on a commission-plan price in the billed period; Measure, Pro and Team are never
billed a commission, and any other case is held for manual review instead of
being invoiced.
Fixed
- LangChain.js with a model string such as
"openai:gpt-4o-mini"saves. That
form (the one in the README and inbvsala init) goes through the OpenAI
Responses API, whose message carries nofinish_reason(@langchain/openai
1.6) or reports it as"completed"(1.8). The adapter did not read it as a
finished answer, so no answer was replayable: an exact repeat and two identical
requests in flight each reached the provider twice. It now reads the Responses
status(completedis a finished answer, or a tool call;incompletebecause
ofmax_output_tokensis a truncated one), and an answer that carries the
provider's own tool outputs (web search, code interpreter) is never replayed. A
ChatOpenAIinstance on Chat Completions already worked. 1.2.3 had the same bug.
Reasoning models on the Responses API (gpt-5, the o series) still reach the
provider on every repeat, as in 1.2.3: their answer carries a reasoning item the
adapter does not replay. With those models, pass aChatOpenAIinstance. - The Python client no longer says the gateway needs a key. When no gateway
answered, it said the gateway "needs BIVELIO_SERVICE_KEY"; it starts with no key,
free, in COMMUNITY mode, and the message now says so.python -m bvsala status
no longer adds(no BIVELIO_SERVICE_KEY): a gateway with no key meters locally, so
it printsmetering: on. - A key that is set but wrong says how to keep running free. When the gateway
does not start becauseBIVELIO_SERVICE_KEYis malformed or not recognised, or
BIVELIO_LICENSE_KEYdoes not verify, the message adds, after the fix, that
unsetting both keys and relaunching runs the gateway free in COMMUNITY mode. A
service key that is not plain ASCII (thebvk_…placeholder of an example) is
reported as malformed instead of as a network error. A leftover message that said
the gateway does not start without a subscription and a service key is gone. - Example blocks that are pasted whole start free. The optional key lines in
the README and in the terminal guides (export BIVELIO_SERVICE_KEY=bvk_…, its
PowerShell form andexport BIVELIO_LICENSE_KEY=…) are commented out and marked
OPTIONAL; pasted as written, the placeholder became the key and the gateway
exited with code 1. - With the free Measure license, a failed entitlements fetch or a deleted service
key no longer says "savings features disabled". With Measure the gateway's
levers keep working in both cases, and the lines say what is actually lost (the
organization status refresh, or the usage reporting to your dashboard). With a
paid license the lines and the behaviour are those of 1.2.3: the savings features
switch off (fail-closed) and traffic keeps flowing. bvsalasays what it is doing in observe-only mode. With
BVSALA_GATEWAY_OBSERVE_ONLY=1the startup banner prints one observe-only line
instead of "cache TTL tuning is the only one ON by default", and the exit summary
explains a $0.00 saving by that mode, not by the TTL rule. The banner names the
variable that turns the context elision dials on, andbvsala <unknown command>
says the command does not exist before printing the help (exit code 1, as before).- The tarball is readable by every user, whatever the packer's umask. A
prepack
step adds read permission for everyone to the published files, so a tarball packed
from a tree created with umask 077 no longer installs files only their owner can
read. Releases built by CI were not affected.
Documentation and license texts
- README and PyPI page. They list what is on by default (exact cache,
deduplication, local resolvers, prompt-cache placement, trimming of superseded
tool results, compact serialization of the structured data you pass) and what you
switch on. "Shared caches" is gone from the paid column: BiVelio hosts no cache.
A cache shared by several machines is a store you run, through theexactCache
option (three methods,get,set,delete, over a key-value store such as
Redis), free and with no key. The README says that the package ships no compressor
(compaction of JSON tool outputs is opt-in and lossless) and that no compression
figure is published. It says that with Claude Code out of the box the gateway
measures and the default lever saves nothing, because that lever only acts when
the client asks for the 1-hour cache. The −82.76 % figure is stated with the
opt-in it needs (savings.cachePrefix: true) and with what it was measured
against (the layer itself without that option, 20 requests per arm). - Terminal guides in English. The per-terminal guides in
docs/terminales
(shipped in the package) are in English, with the real log lines. LICENSE-CLOUD.md§1 andNOTICE. §1 now says that under a Measure license
the software applies exactly the same saving levers as with no key, and that
Measure usage is never billed and never part of any commission; under a paid
license, trimming of superseded tool results only acts inside a tool loop on
Anthropic throughAnthropicProvider. "Shared caches" is removed from the list of
Cloud Services in both files.SECURITY.md, Availability. The gateway section says that with the free
Measure license the levers do not depend on the entitlements fetch, and that with
a paid license a failed fetch switches them off, as in 1.2.3.- What a key ties you to, and the conditions of the headline figures. The README,
the PyPI page,init,doctorand--helpsay that a key, the free Measure key
included, makes the layer depend on savings.bivelio.com: withlicenseServerUrl, 72
hours with no answer fail closed withLicenseErroruntil it answers or you remove
the key; the gateway with a service key needs it to start. With no key there is no
such dependency. The 31.50 % / 75.08 % figures now say their workload (built from
GSM8K questions, 30 % exact repeats) and that about 41 points of the 75.08 % are
Anthropic's cache pricing.--helpand the terminal guide describe cache TTL tuning
as the code runs it: only on turns where a large part of the request is new, never
on chained turns. A license that is expired, revoked or missing now says, in the SDK
and in the gateway, that removing the key keeps the layer running free. The
terminal guide says when cache TTL tuning is armed: by default with no key and
with Measure, and with a paid license only if that license includes it
(fail-closed).