openzoo 0.48.37 → 0.48.39
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/lib/launch.js +1 -1
- package/lib/proxy.js +12 -1
- package/package.json +1 -1
package/lib/launch.js
CHANGED
|
@@ -177,7 +177,7 @@ export async function launchClaude(argv) {
|
|
|
177
177
|
// ALWAYS shown, 4dp, even at 1.0000. Hiding it when there is no saving
|
|
178
178
|
// reads as "no data"; printing 1.0000x says "measured, and it is level"
|
|
179
179
|
// — which is the difference between an omission and a fact.
|
|
180
|
-
+ 'const sx=Number(j.savingX);const sv=Number(j.savedUsd)||0;'
|
|
180
|
+
+ 'const sx=Number(j.savingX);const sv=Number((j.spilled||{}).savedUsd ?? j.savedUsd)||0;'
|
|
181
181
|
+ 'const col=(sx>1)?"\\x1b[32m":"\\x1b[90m";'
|
|
182
182
|
// Prefer the SPILLED-call ratio: the session-wide one averages in every
|
|
183
183
|
// small turn that had nothing to offload, so it slides toward 1.0 as a
|
package/lib/proxy.js
CHANGED
|
@@ -355,7 +355,11 @@ async function spillTranscript(body, log) {
|
|
|
355
355
|
// in the bound corpus and comes back through recall.
|
|
356
356
|
let tailStart = cut;
|
|
357
357
|
{
|
|
358
|
-
|
|
358
|
+
// 24000 was still too fat: MEASURED on 9 live spilled calls, direct came
|
|
359
|
+
// back identical to billed to the cent, i.e. the gateway never computed a
|
|
360
|
+
// counterfactual because promptTokens >= corpusTokens. The tail has to be
|
|
361
|
+
// small enough that the BOUND corpus is the bigger number.
|
|
362
|
+
const budget = Number(process.env.OPENZOO_TAIL_MAX_CHARS || 6000);
|
|
359
363
|
let used = 0;
|
|
360
364
|
for (let i = msgs.length - 1; i >= cut; i--) {
|
|
361
365
|
used += msgText(msgs[i]).length;
|
|
@@ -690,6 +694,7 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
|
|
|
690
694
|
reusedBinds: spillReuses,
|
|
691
695
|
spend: spillSpend,
|
|
692
696
|
direct: spillDirect,
|
|
697
|
+
savedUsd: Math.max(0, spillDirect - spillSpend),
|
|
693
698
|
savingX: spillSpend > 0 ? Number((spillDirect / spillSpend).toFixed(4)) : null,
|
|
694
699
|
},
|
|
695
700
|
spendUsd: sessionSpent,
|
|
@@ -1101,6 +1106,12 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
|
|
|
1101
1106
|
sessionCogs += typeof x.cogsUsd === 'number' ? x.cogsUsd : x.billedUsd / MARKUP;
|
|
1102
1107
|
sessionDirect += typeof x.directUsd === 'number' ? x.directUsd : x.billedUsd;
|
|
1103
1108
|
if (didSpill) {
|
|
1109
|
+
// THE number that settles why a spilled call did or did not save:
|
|
1110
|
+
// the gateway only prices a counterfactual when corpusTokens >
|
|
1111
|
+
// promptTokens, so a tail that rivals the corpus silently falls
|
|
1112
|
+
// back to markup and direct collapses onto billed.
|
|
1113
|
+
const lc = x.lecore || {};
|
|
1114
|
+
log(`spill priced: ${x.pricing} · corpus ${lc.corpusTokens ?? '?'} tok vs sent ${lc.tokensBefore ?? '?'} -> ${lc.tokensAfter ?? '?'} · billed ${(x.billedUsd ?? 0).toFixed(5)} direct ${(x.directUsd ?? 0).toFixed(5)}`);
|
|
1104
1115
|
spillSpend += x.billedUsd;
|
|
1105
1116
|
spillDirect += typeof x.directUsd === 'number' ? x.directUsd : x.billedUsd;
|
|
1106
1117
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.39",
|
|
4
4
|
"description": "Local x402-paying proxy + MCP server for openzoo.fun — point any OpenAI-compatible harness (Cursor, Claude Code, aider, SDKs) at localhost and it pays per call from a local burner wallet. Solana and Base rails live; Robinhood experimental.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|