@bivelio/savings-layer 0.4.13 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -9
- package/dist/gateway/bin.js +22 -20
- package/dist/index.d.ts +59 -2
- package/dist/index.js +621 -611
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://savings.bivelio.com/brand/savings-logo.png" alt="Savings. by BiVelio" width="360">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">The savings layer for your LLM bill</h1>
|
|
2
6
|
|
|
3
7
|
<p align="center">
|
|
4
|
-
<
|
|
8
|
+
<em>Cut your AI bill — and see exactly why, measured on the same meter your provider bills you with.</em>
|
|
5
9
|
</p>
|
|
6
10
|
|
|
7
11
|
<p align="center">
|
|
@@ -10,10 +14,26 @@
|
|
|
10
14
|
<img src="https://img.shields.io/badge/license-commercial-0F1218" alt="Commercial license">
|
|
11
15
|
</p>
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
### In plain words
|
|
18
|
+
|
|
19
|
+
Every request your app sends to an AI is paid for by the text going in and out.
|
|
20
|
+
**Savings** sits on that path and lets through only what's needed — skipping calls
|
|
21
|
+
that don't have to happen, and trimming what does — so you pay for less. It is not a
|
|
22
|
+
promise you take on faith: **every saving is measured with the provider's official
|
|
23
|
+
meter, the same one on your bill**, and handed back to you request by request.
|
|
24
|
+
|
|
25
|
+
**We only earn when you save.** Our commission comes out of the measured saving,
|
|
26
|
+
never out of your pocket — most of what you save stays with you, and a month with no
|
|
27
|
+
saving is zero commission. And your prompts **never leave your infrastructure**:
|
|
28
|
+
BiVelio only ever sees counts and cost, never your content.
|
|
29
|
+
|
|
30
|
+
### For engineers, in one line
|
|
31
|
+
|
|
32
|
+
`@bivelio/savings-layer` (**BV‑SALA**) is one layer you add inside your code, right
|
|
33
|
+
where your app calls the OpenAI‑compatible or Anthropic API. For every request it
|
|
34
|
+
picks the cheapest execution that still meets your quality bar and hands you an
|
|
35
|
+
auditable `SavingsReport` — the same numbers your dashboard reads. Traffic still
|
|
36
|
+
goes straight from your app to your provider; the SDK is never a middleman server.
|
|
17
37
|
|
|
18
38
|
> **Commercial software — © 2026 BiVelio Inc.** Free to install, **paid to run**:
|
|
19
39
|
> BV‑SALA is fail‑closed and executes only with an active BiVelio license key.
|
|
@@ -23,14 +43,20 @@ you an auditable `SavingsReport`. Your bill drops, and you can verify why.
|
|
|
23
43
|
|
|
24
44
|
## Where it installs
|
|
25
45
|
|
|
46
|
+
<p align="center">
|
|
47
|
+
<img src="https://savings.bivelio.com/en/how-it-works/opengraph-image" alt="Your application → BV-SALA → provider API. The bill drops from $330 to $160 a month, measured." width="720">
|
|
48
|
+
</p>
|
|
49
|
+
|
|
26
50
|
Your application → **BV‑SALA** → provider API. Traffic always goes straight from
|
|
27
51
|
your app to your provider — BV‑SALA is a library inside your code, never a
|
|
28
52
|
middleman server, and it works with any OpenAI‑compatible endpoint (OpenAI, Azure,
|
|
29
53
|
vLLM, SGLang, a gateway) as well as Anthropic.
|
|
30
54
|
|
|
31
|
-
**
|
|
32
|
-
|
|
33
|
-
|
|
55
|
+
**Is this for me?** If your product or automation calls the AI **with its own API
|
|
56
|
+
key** — and pays a per‑token bill for it — yes: this is exactly where the saving
|
|
57
|
+
installs. **Only use ChatGPT or Claude?** Then there is nothing to install: those
|
|
58
|
+
products charge a flat subscription, so there is no per‑token bill to cut. The whole
|
|
59
|
+
story, in plain words:
|
|
34
60
|
**[Where does the saving install?](https://savings.bivelio.com/en/how-it-works)**
|
|
35
61
|
|
|
36
62
|
**Claude Code, Codex CLI, Goose or Qwen Code with an API key?** The package also
|
package/dist/gateway/bin.js
CHANGED
|
@@ -38,13 +38,15 @@ t-5.6-sol":{inputPer1k:.004,outputPer1k:.02,cachedInputPer1k:4e-4},"gpt-5.6-terr
|
|
|
38
38
|
"claude-opus-4-6":{inputPer1k:.005,outputPer1k:.025,cachedInputPer1k:5e-4},"claude-opus-4-7":{inputPer1k:.005,outputPer1k:.025,cachedInputPer1k:5e-4},"claude-opus-4-8":{inputPer1k:.005,outputPer1k:.025,
|
|
39
39
|
cachedInputPer1k:5e-4},"claude-opus-5":{inputPer1k:.005,outputPer1k:.025,cachedInputPer1k:5e-4},"claude-opus-4":{inputPer1k:.015,outputPer1k:.075,cachedInputPer1k:.0015},"claude-sonnet-4-5":{inputPer1k:.003,
|
|
40
40
|
outputPer1k:.015,cachedInputPer1k:3e-4},"claude-sonnet-4-6":{inputPer1k:.003,outputPer1k:.015,cachedInputPer1k:3e-4},"claude-sonnet-5":{inputPer1k:.002,outputPer1k:.01,cachedInputPer1k:2e-4},"claude-f\
|
|
41
|
-
able-5":{inputPer1k:.01,outputPer1k:.05,cachedInputPer1k:.001},"claude-
|
|
42
|
-
"claude-
|
|
43
|
-
cachedInputPer1k
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
able-5":{inputPer1k:.01,outputPer1k:.05,cachedInputPer1k:.001},"claude-fable-5-1":{inputPer1k:.01,outputPer1k:.05,cachedInputPer1k:25e-5},"claude-mythos-5-1":{inputPer1k:.01,outputPer1k:.05,cachedInputPer1k:25e-5},
|
|
42
|
+
"claude-mythos-5":{inputPer1k:.01,outputPer1k:.05,cachedInputPer1k:.001},"claude-sonnet-4":{inputPer1k:.003,outputPer1k:.015,cachedInputPer1k:3e-4},"claude-haiku-4-5":{inputPer1k:.001,outputPer1k:.005,
|
|
43
|
+
cachedInputPer1k:1e-4},"claude-3-5-sonnet":{inputPer1k:.003,outputPer1k:.015,cachedInputPer1k:3e-4},"claude-3-5-haiku":{inputPer1k:8e-4,outputPer1k:.004,cachedInputPer1k:8e-5},"claude-3-opus":{inputPer1k:.015,
|
|
44
|
+
outputPer1k:.075,cachedInputPer1k:.0015},"claude-3-haiku":{inputPer1k:25e-5,outputPer1k:.00125,cachedInputPer1k:3e-5},"gemini-3.7-flash":{inputPer1k:75e-5,outputPer1k:.00375,cachedInputPer1k:75e-6},"g\
|
|
45
|
+
emini-3.5-flash":{inputPer1k:.0015,outputPer1k:.009,cachedInputPer1k:15e-5},"gemini-3.5-flash-lite":{inputPer1k:3e-4,outputPer1k:.0025,cachedInputPer1k:3e-5},"gemini-3.1-pro-preview":{inputPer1k:.002,
|
|
46
|
+
outputPer1k:.012,cachedInputPer1k:2e-4},"gemini-2.5-pro":{inputPer1k:.00125,outputPer1k:.01,cachedInputPer1k:125e-6},"gemini-2.5-flash":{inputPer1k:3e-4,outputPer1k:.0025,cachedInputPer1k:3e-5}};function Ne(e,t,n){
|
|
47
|
+
if(!n)return;let r=e[n];if(r)return r;let o=n.lastIndexOf("/"),s=o>=0?n.slice(o+1):n,i=e[s];if(i)return i;for(let a of t){if(!s.startsWith(a))continue;let u=s.charAt(a.length);if(u!==""&&u!=="-"&&u!==
|
|
48
|
+
"."&&u!=="_")continue;let p=s.slice(a.length+1);if(!(/^\d/.test(p)&&!/^\d{4}/.test(p)))return e[a]}}function me(e){return Object.keys(e).sort((t,n)=>n.length-t.length)}var Mt=me(pe);function M(e){return Ne(
|
|
49
|
+
pe,Mt,e)}var $=class{resto="";uso=null;elisionObservada=null;eventos={};observar(t){this.resto+=typeof t=="string"?t:t.toString("utf8");let n;for(;(n=this.resto.indexOf(`
|
|
48
50
|
|
|
49
51
|
`))>=0;){let r=this.resto.slice(0,n);this.resto=this.resto.slice(n+2);let o=/^event: (.+)$/m.exec(r)?.[1];if(o&&(this.eventos[o]=(this.eventos[o]??0)+1),o!=="message_start"&&o!=="message_delta")continue;
|
|
50
52
|
let s=/^data: (.+)$/m.exec(r)?.[1];if(s)try{let i=JSON.parse(s),a=ze(i.context_management);a&&(this.elisionObservada=a);let u=i.usage??i.message?.usage;if(u){let p=u.cache_creation||this.uso?.cache_creation?
|
|
@@ -115,7 +117,7 @@ c)),o;if(e.serviceAccountKey){o=new z({url:e.meteringUrl??"https://savings.bivel
|
|
|
115
117
|
"gateway-ingest-auth",`[bvsala gateway] la ingesta de uso rechaza la credencial (${d}). El tr\xE1fico sigue fluyendo (avisar, nunca romper), pero este uso no est\xE1 llegando al panel. Revisa BIVELIO_SERVIC\
|
|
116
118
|
E_KEY y el estado de la suscripci\xF3n en savings.bivelio.com.`)});let c=Z();e.seatId?o.setSeat(e.seatId,c):ee(e.serviceAccountKey).then(d=>o?.setSeat(d,c)).catch(()=>{}),o.start();}else E("gateway-sin\
|
|
117
119
|
-clave","[bvsala gateway] sin BIVELIO_SERVICE_KEY: el gateway reenv\xEDa el tr\xE1fico pero NO mide. Consigue tu clave en savings.bivelio.com/dashboard/install para ver el gasto en tu panel.");let s=e.
|
|
118
|
-
coalescer?new se:null,i=e.sombra&&o?new ne:null,a=e.elision&&e.serviceAccountKey?new oe({url:new URL("/api/org/entitlements",e.meteringUrl??"https://savings.bivelio.com/api/metering/usage").toString(),
|
|
120
|
+
coalescer?new se:null,i=e.sombra&&o?new ne:null,a=e.elision!==false&&e.serviceAccountKey?new oe({url:new URL("/api/org/entitlements",e.meteringUrl??"https://savings.bivelio.com/api/metering/usage").toString(),
|
|
119
121
|
serviceAccountKey:e.serviceAccountKey,...e.fetchImpl?{fetchImpl:e.fetchImpl}:{},log:r}):null,u=c=>c==="/v1/messages"?new $:c.endsWith("/responses")?new te:null,p=(c,d,h,b,v,f,y,R)=>{if(!o||!h)return;let W=o,
|
|
120
122
|
V=h,S=Ve(d,f);if(!S){E(`gateway-sin-modelo:${v}`,`[bvsala gateway] no se pudo leer el modelo del cuerpo de ${v} (content-encoding: ${f??"ninguno"}); su uso se reenv\xEDa pero no se mide.`);return}let T=Ue(
|
|
121
123
|
S,h);T?(o.record(b?Ke(c,S,T,y):qe(c,S,T,y,R)),r(`[gateway] POST ${v} ${b?"\xB7 COALESCIDA (llamada evitada)":""} \xB7 ${S} \xB7 $${T.costeUsd.toFixed(6)} (in ${T.tokens.entrada}, cache\u2191${T.tokens.
|
|
@@ -203,7 +205,7 @@ match(/\n/g)??[]).length;r+=i+Math.floor(Math.max(0,o.length-1)/2);}else /[A-Za-
|
|
|
203
205
|
Math.ceil(t.length/4))}},we=new Se;var Te=class{estimators=new Map;modelToTokenizer=new Map;fallbackId;constructor(t=we){this.fallbackId=t.id,this.estimators.set(t.id,t);}register(t){return this.estimators.set(t.id,t),this}mapModel(t,n){
|
|
204
206
|
return this.modelToTokenizer.set(t,n),this}resolve(t){let n=t.tokenizer?this.estimators.get(t.tokenizer):void 0;if(n)return n;if(t.model){let r=this.modelToTokenizer.get(t.model);if(r){let o=this.estimators.
|
|
205
207
|
get(r);if(o)return o}}return this.estimators.get(this.fallbackId)}count(t,n){return this.resolve(n).count(t)}};new Te;new TextEncoder;new TextDecoder;new TextDecoder;var An={"gpt-4o-mini":{deltaTokens:-16,salidaDelBrazoA:72,contrato:"triage (6 fields, long enums)",pares:8},"gpt-4o":{deltaTokens:3,salidaDelBrazoA:75,contrato:"triage (6 fields, long enums)",pares:8}};
|
|
206
|
-
me(An);var _e="0.4.
|
|
208
|
+
me(An);var _e="0.4.14";var[,,k,...O]=process.argv;function Nn(){console.log(`bvsala ${_e} \u2014 BiVelio Savings Layer
|
|
207
209
|
|
|
208
210
|
Comandos:
|
|
209
211
|
gateway [--puerto N] Proxy local medidor (por defecto 8402) para terminales que
|
|
@@ -250,15 +252,15 @@ to"),U=J?0:Ae>=0?Number(O[Ae+1]):8402;(!Number.isInteger(U)||(k==="doctor"?U<1:U
|
|
|
250
252
|
"--write")&&(console.error("[bvsala doctor] --write todav\xEDa no existe: el doctor solo imprime; copia el bloque a mano."),process.exit(1));let e=await ut(U);console.log(e.texto),process.exit(0);}var D=J?
|
|
251
253
|
ke(k,0,O,{modoCodex:k==="codex"?lt({leerAuth:()=>readFileSync(join(homedir(),".codex","auth.json"),"utf8")}):void 0}):null,Pe=process.env.BIVELIO_SERVICE_KEY,jn=J&&process.env.BVSALA_GATEWAY_LOG!=="1",j=await st({puerto:U,
|
|
252
254
|
...jn?{log:()=>{}}:{},...Pe?{serviceAccountKey:Pe}:{},...process.env.BVSALA_SEAT_ID?{seatId:process.env.BVSALA_SEAT_ID}:{},...process.env.BVSALA_GATEWAY_UPSTREAM?{upstream:process.env.BVSALA_GATEWAY_UPSTREAM}:
|
|
253
|
-
D?.upstream?{upstream:D.upstream}:{},...process.env.BVSALA_GATEWAY_COALESCE==="1"?{coalescer:true}:{},...process.env.BVSALA_GATEWAY_SHADOW==="1"?{sombra:true}:{}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
255
|
+
D?.upstream?{upstream:D.upstream}:{},...process.env.BVSALA_GATEWAY_COALESCE==="1"?{coalescer:true}:{},...process.env.BVSALA_GATEWAY_SHADOW==="1"?{sombra:true}:{},elision:process.env.BVSALA_GATEWAY_ELISION!==
|
|
256
|
+
"0",...process.env.BVSALA_METERING_URL?{meteringUrl:process.env.BVSALA_METERING_URL}:{}}),zn=process.env.BVSALA_GATEWAY_UPSTREAM??D?.upstream??"https://api.anthropic.com";console.log(`[bvsala gateway]\
|
|
257
|
+
v${_e} escuchando en http://127.0.0.1:${j.puerto} \u2192 ${zn}`);console.log(`[bvsala gateway] medici\xF3n: ${Pe?"ACTIVA (clave de servicio presente)":"APAGADA (falta BIVELIO_SERVICE_KEY)"}`);process.
|
|
258
|
+
env.BVSALA_GATEWAY_UPSTREAM&&D?.upstream&&process.env.BVSALA_GATEWAY_UPSTREAM!==D.upstream&&console.error(`[bvsala ${k}] AVISO: BVSALA_GATEWAY_UPSTREAM=${process.env.BVSALA_GATEWAY_UPSTREAM} pisa el u\
|
|
259
|
+
pstream de este terminal (${D.upstream}). Si no es lo que quieres, quita la variable.`);k==="codex"&&!Fe()&&console.error(`[bvsala codex] AVISO: este Node (${process.version}) no descomprime zstd y Co\
|
|
260
|
+
dex manda el cuerpo en zstd: el tr\xE1fico pasa pero NO se mide. Usa Node \u2265 22.15.`);if(D&&J){let e=ke(k,j.puerto,O,{...D.upstream?{modoCodex:D.upstream.includes("chatgpt.com")?"chatgpt":"api-key"}:
|
|
261
|
+
{}});e.nota&&console.log(`[bvsala ${k}] ${e.nota}`);let t=e.bin;if(process.platform==="win32"){let r=ct(e.bin);r.tipo==="exe"?t=r.ruta:r.tipo==="solo-shim"&&(console.error(`[bvsala ${k}] \`${e.bin}\` e\
|
|
262
|
+
st\xE1 instalado como shim de npm (${r.ruta}) y Windows no puede lanzarlo de forma segura con argumentos (CVE-2024-27980). Inst\xE1lalo con su instalador nativo (deja un ${e.bin}.exe en el PATH) o usa\
|
|
263
|
+
la receta manual de docs/terminales/.`),await j.cerrar(),process.exit(127));}let n=spawn(t,e.args,{stdio:"inherit",env:{...process.env,...e.env}});n.on("error",r=>{console.error(`[bvsala ${k}] no se pudo\
|
|
264
|
+
lanzar \`${e.bin}\`: ${String(r)}. \xBFEst\xE1 instalado y en el PATH?`),j.cerrar().then(()=>process.exit(127));}),n.on("exit",(r,o)=>{j.cerrar().then(()=>process.exit(r??(o?1:0)));});}else console.log(
|
|
265
|
+
`[bvsala gateway] apunta tu terminal (o usa \`bvsala ${ye.join("|")}\`): ANTHROPIC_BASE_URL=http://127.0.0.1:${j.puerto} claude \xB7 bvsala doctor para el resto`);var Tt=async()=>{await j.cerrar(),
|
|
264
266
|
process.exit(0);};process.on("SIGINT",()=>{Tt();});process.on("SIGTERM",()=>{Tt();});
|
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,19 @@ declare class SavingsLedger {
|
|
|
58
58
|
sentInputLocal: number;
|
|
59
59
|
/** Tokens que la capa quitó de ese prompt, en cuenta LOCAL. */
|
|
60
60
|
removedInputLocal: number;
|
|
61
|
+
/**
|
|
62
|
+
* Tokens (LOCAL ruler) that tool_result ELISION removed from the sent prompt.
|
|
63
|
+
* They exist to be SUBTRACTED from `removedInputLocal`: live deletion really
|
|
64
|
+
* lowers `sentInputLocal`, so without this correction the elision saving would
|
|
65
|
+
* enter the reconstructed baseline and the commission, labelled "estimated".
|
|
66
|
+
* The doctrine is the opposite — "live count, shadow money": elision is a COUNT
|
|
67
|
+
* (ledger 2 `eliminatedInput`), its dollar is measured by the shadow lane out
|
|
68
|
+
* of commission, and `basis` stays "measured". Deliberately distinct from the
|
|
69
|
+
* tool-selector drop, which DOES count in the baseline (a declared tool that is
|
|
70
|
+
* not sent is an attributable saving; a superseded tool_result is redundancy
|
|
71
|
+
* not yet billed as verifiable against the invoice).
|
|
72
|
+
*/
|
|
73
|
+
elididoLocal: number;
|
|
61
74
|
/**
|
|
62
75
|
* ¿El estimador que produjo las dos cifras anteriores cuenta con la regla del
|
|
63
76
|
* proveedor? Lo fija el pipeline al resolver el tokenizador del modelo.
|
|
@@ -169,7 +182,7 @@ declare class SavingsLedger {
|
|
|
169
182
|
* catalogue stays out of the way.
|
|
170
183
|
*/
|
|
171
184
|
/** When these prices were last checked against the providers' public rates. */
|
|
172
|
-
declare const PRECIOS_AL_DIA = "2026-
|
|
185
|
+
declare const PRECIOS_AL_DIA = "2026-09-06";
|
|
173
186
|
/**
|
|
174
187
|
* Key = the model id as the provider publishes it, without a vendor prefix.
|
|
175
188
|
* Lookup tries the exact id, then the id without its provider prefix, then the
|
|
@@ -296,6 +309,27 @@ interface SavingsToggles {
|
|
|
296
309
|
exactCache?: boolean;
|
|
297
310
|
semanticCache?: boolean | "safe-only";
|
|
298
311
|
compression?: boolean | "auto";
|
|
312
|
+
/**
|
|
313
|
+
* OPT-IN. Elide old, large tool_results from a multi-turn context before the
|
|
314
|
+
* request is sent, replacing each one's body with a short stable stub while
|
|
315
|
+
* keeping its `role:"tool"`, `toolCallId` and position. This is the v0
|
|
316
|
+
* (age × size) policy the shadow lane measures — productionized to actually
|
|
317
|
+
* shorten the outgoing prompt, on the generic tool_result segment nothing else
|
|
318
|
+
* in the pipeline touches.
|
|
319
|
+
*
|
|
320
|
+
* IT ONLY RUNS WHEN THE POLICY ALLOWS IT. Like the semantic cache, elision is
|
|
321
|
+
* disabled for write/destructive tools, freshness-sensitive, personalized or
|
|
322
|
+
* stochastic requests, and for `freshnessBucket: "day"` — dropping the output
|
|
323
|
+
* of a past action, or old context a fresh answer still needs, is exactly the
|
|
324
|
+
* degradation the layer must not cause.
|
|
325
|
+
*
|
|
326
|
+
* FIDELITY FLOOR. The newest tool_results are never elided (a keep-floor of at
|
|
327
|
+
* least 8, imported from the provider dial S4a); v0's own age≥2 rule is weaker
|
|
328
|
+
* than that floor, so the floor wins. What it removes is a COUNT on the panel
|
|
329
|
+
* (`eliminated_tokens`); its money value is estimated only in the shadow lane
|
|
330
|
+
* and never enters your commission — your invoice stays the source of truth.
|
|
331
|
+
*/
|
|
332
|
+
elision?: boolean;
|
|
299
333
|
serialization?: boolean | "auto";
|
|
300
334
|
singleflight?: boolean;
|
|
301
335
|
deterministicResolvers?: boolean;
|
|
@@ -1255,6 +1289,13 @@ interface Policy {
|
|
|
1255
1289
|
allowSingleflight: boolean;
|
|
1256
1290
|
/** May we run natural-language compression on the context? */
|
|
1257
1291
|
allowCompression: boolean;
|
|
1292
|
+
/**
|
|
1293
|
+
* May the SDK elide old, large tool_results before resending? Computed, not
|
|
1294
|
+
* hardcoded like `allowCompression`: eliding drops whole tool outputs, so it
|
|
1295
|
+
* honors the same vetoes as the semantic cache — write tools, freshness,
|
|
1296
|
+
* personalization, stochastic sampling and `day`.
|
|
1297
|
+
*/
|
|
1298
|
+
allowElision: boolean;
|
|
1258
1299
|
/** Does the request demand current/live data? */
|
|
1259
1300
|
requiresFreshData: boolean;
|
|
1260
1301
|
/** Does the request have (or request) side effects? */
|
|
@@ -2362,6 +2403,22 @@ interface AnthropicOptions {
|
|
|
2362
2403
|
* pointless: the extra breakpoints are rejected by the API, not ignored.
|
|
2363
2404
|
*/
|
|
2364
2405
|
maxCacheBreakpoints?: number;
|
|
2406
|
+
/**
|
|
2407
|
+
* When true, requests that the pipeline decided to mark also carry the
|
|
2408
|
+
* request-level `cache_control` (Anthropic's automatic caching): the provider
|
|
2409
|
+
* places one extra breakpoint on the last cacheable block and moves it
|
|
2410
|
+
* forward as the conversation grows, so the history beyond the declared
|
|
2411
|
+
* stable prefix is cached incrementally too. It spends one of the four
|
|
2412
|
+
* breakpoint slots and never fires when the economic gate declined to mark.
|
|
2413
|
+
*
|
|
2414
|
+
* Off by default, and deliberately so: the moving breakpoint writes the
|
|
2415
|
+
* volatile tail of EVERY marked request at the 1.25x write premium. That
|
|
2416
|
+
* pays for itself on conversational or agentic traffic — the next turn reads
|
|
2417
|
+
* the whole history at 0.1x — and loses money on one-shot traffic where
|
|
2418
|
+
* nothing ever reads it back. It is also rejected by legacy Bedrock
|
|
2419
|
+
* deployments. Turn it on when your traffic is multi-turn.
|
|
2420
|
+
*/
|
|
2421
|
+
automaticCache?: boolean;
|
|
2365
2422
|
/**
|
|
2366
2423
|
* Whether a request carrying BOTH the caller's tools and an output contract
|
|
2367
2424
|
* may send `tool_choice: {type: "any"}`, which obliges the model to answer
|
|
@@ -3262,6 +3319,6 @@ declare function createSavingsLayer(config: Omit<SavingsLayerConfig, "tokenizer"
|
|
|
3262
3319
|
* constant to package.json so the two can never drift.
|
|
3263
3320
|
*/
|
|
3264
3321
|
|
|
3265
|
-
declare const BV_SALA_VERSION = "0.4.
|
|
3322
|
+
declare const BV_SALA_VERSION = "0.4.14";
|
|
3266
3323
|
|
|
3267
3324
|
export { type AnthropicOptions, AnthropicProvider, BV_SALA_VERSION, type BivelioHandoff, CATALOGO, COMPACT_ROWS_INSTRUCTION, type CacheOutcome, type CacheTier, type CachedAnswer, type CanonicalRequest, type ChatMessage, type CompactRowsDecodeOptions, type CompactRowsOptions, type CompactVerification, type CompressionEconomics, type CompressionPolicyInput, type CompressionRequest, type CompressionResult, type Compressor, type ConstraintBackend, type ConstraintBackendId, type ConstraintPlan, type ConversationState, type CostBasis, type CostModel, DEFAULT_COST_MODEL, DEFAULT_MAX_STALENESS_SECONDS, type DeferredExecutionReport, type DeterministicResolver, EMBEDDED_PUBLIC_KEY, type EmbeddingFn, type EvidenceDoc, type ExactCache, ExactTokenizer, type ExecutionClass, ExecutionRouter, type FormatChoice, FormatSelector, type FormatSelectorOptions, type HandoffFact, HeuristicEstimator, InMemoryExactCache, InMemorySemanticCache, type JsonSchema, LicenseError, type LicenseGate, type LicenseKeyset, type LicenseStatus, type LicenseTokenPayload, type LocalClassifier, MODELOS_POR_CODIFICACION, MODELS_BY_ENCODING, type MemoryDelta, type MessageRole, MockProvider, type MockProviderOptions, type ModelCascadeMode, type ModelCascadeReport, type ModelCascadeSettings, type OpenAICompatibleOptions, OpenAICompatibleProvider, type OutputContract, PRECIOS_AL_DIA, type Policy, type ProtectedSpan, type Provider, type ProviderRequest, type ProviderResponse, type ProviderUsage, QUALITY_STATUSES, type QualityStatus, type RequestContext, type Reranker, type ResolvedDeps, type ResolvedGate, type ResolvedLicense, ResolverRegistry, type ResolverResult, type RetrievalOptions, type RetrievalOutcome, type RetrievalPlan, type Retriever, type RevocationListBody, type RevocationListVerification, type RevocationPollEvent, RevocationPoller, type RevocationPollerOptions, RevocationSnapshot, type RouteDecision, type SavingsLayer, type SavingsLayerConfig, SavingsLedger, type SavingsReport, type SavingsRequest, type SavingsResult, type SavingsToggles, SchemaRegistry, type SemanticCacheOptions, type SemanticHit, type SemanticRecord, type SemanticVerifier, type SerializationFormat, type Serializer, Singleflight, type TokenEstimator, TokenizerRegistry, type ToolCallRequest, type ToolDescriptor, type ToolRisk, type ToolSelection, ToolSelector, type ToolSelectorOptions, TraceCollector, type TraceEvent, UMBRAL_LOCAL, UsageEmitter, type UsageEmitterOptions, type ValidationError, type ValidationResult, adaptiveK, arithmeticResolver, buildExactKey, buildInflightKey, canonicalize, compactRowsSerializer, compresionFiel, computeNextDelay, cosine, createCompactRowsSerializer, createDefaultResolvers, createHandoff, createMockProvider, createSavingsLayer, csvSerializer, decodeCompactRows, dedupe, defaultTokenizerRegistry, deriveSeatId, deriveStatus, detectCi, embebedorLocal, emptyState, encodeCompactRows, evalArithmetic, evaluatePolicy, executeRetrievalPlan, gateFromKey, heuristicEstimator, isKeyset, isStrictCompatible, jsonCompactSerializer, keyTokensMatch, liveGateFromKey, mergeDelta, modelFamilyOf, multisetEqual, negationCount, noopCompressor, normalizeText, numericTokens, precioDeLista, projectContext, providerNativeBackend, randomId, registerExactTokenizer, registrarTokenizadorExacto, renderState, resolveConstraintBackend, resolveDependencies, resolveLicense, sha256, shouldCompress, stableStringify, uniformColumns, validateAgainstSchema, vectorLocal, verifyCompactSignature, verifyLicenseToken, verifyRevocationList, withProtectedSpans, words };
|