openzoo 0.26.0 → 0.27.0
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/proxy.js +13 -4
- package/package.json +1 -1
package/lib/proxy.js
CHANGED
|
@@ -268,6 +268,12 @@ async function maybeCacheCorpus(req, bodyBuf, log) {
|
|
|
268
268
|
export async function startProxy({ silent = false, requireToken = null, sessionMaxUsd = null, autoTunnel = false } = {}) {
|
|
269
269
|
const client = new PayClient();
|
|
270
270
|
const log = silent ? () => {} : (...a) => console.log(...a);
|
|
271
|
+
// ALWAYS-ON. `silent: true` is used by the editor path to keep startup tidy,
|
|
272
|
+
// but it also swallowed the per-request lines and the payment receipts — so the
|
|
273
|
+
// terminal sat blank and there was no way to tell a working setup from an editor
|
|
274
|
+
// quietly answering from its own backend. Traffic and receipts are the whole
|
|
275
|
+
// point of watching this window; they are never silenced.
|
|
276
|
+
const say = (...a) => console.log(...a);
|
|
271
277
|
let sessionSpent = 0;
|
|
272
278
|
let tunnelSpent = 0;
|
|
273
279
|
// Live balance refresh state — the real implementation is assigned in the
|
|
@@ -472,7 +478,10 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
|
|
|
472
478
|
// carries a model field, not just chat/completions, so /completions,
|
|
473
479
|
// /responses and future shapes all work. Never silent.
|
|
474
480
|
let wantsStream = false;
|
|
475
|
-
if ((req.url || '').includes('/chat/completions') && req.method === 'POST')
|
|
481
|
+
if ((req.url || '').includes('/chat/completions') && req.method === 'POST') {
|
|
482
|
+
servedRequests += 1;
|
|
483
|
+
say(`\n<- request #${servedRequests} from ${(req.headers['user-agent'] || 'unknown').slice(0, 40)}`);
|
|
484
|
+
}
|
|
476
485
|
if (rewritablePath(req.method, req.url)) {
|
|
477
486
|
const rw = await maybeRewriteModel(bodyBuf);
|
|
478
487
|
if (rw) {
|
|
@@ -581,9 +590,9 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
|
|
|
581
590
|
}
|
|
582
591
|
const line = receipt.ok ? receipt.line : `paid retry -> HTTP ${receipt.status}`;
|
|
583
592
|
// Wherever a running total is the thing to watch, it rides the receipt.
|
|
584
|
-
if (requireToken)
|
|
585
|
-
else if (viaTunnel)
|
|
586
|
-
else
|
|
593
|
+
if (requireToken) say(`${line} · session $${sessionSpent.toFixed(6)}`);
|
|
594
|
+
else if (viaTunnel) say(`${line} · public-url session $${tunnelSpent.toFixed(6)}`);
|
|
595
|
+
else say(line);
|
|
587
596
|
scheduleRefresh(4000); // settlement lands on-chain in a few seconds
|
|
588
597
|
}
|
|
589
598
|
// Chat completions come back as one JSON object (settle-before-serve).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
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",
|