openzoo 0.49.4 → 0.49.6
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 +7 -7
- package/lib/demo.js +4 -1
- package/lib/grokui.mjs +449 -26
- package/lib/gui.html +4 -1
- package/lib/livestatus.js +173 -4
- package/lib/mcp.js +3 -1
- package/lib/pay.js +3 -0
- package/lib/podagent.mjs +50 -12
- package/lib/proxy.js +114 -97
- package/lib/racesettle.js +78 -8
- package/lib/spill.js +168 -9
- package/lib/x402.js +13 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ claude mcp add openzoo -- npx -y openzoo mcp
|
|
|
79
79
|
**Windsurf / Cline / any MCP host** — same shape: command `npx`, args `["-y", "openzoo", "mcp"]`, stdio transport.
|
|
80
80
|
|
|
81
81
|
Tools:
|
|
82
|
-
- **`zoo_ask`** — `{prompt, corpus?, model?, max_tokens?}`. The flagship: hand it a *huge* `corpus` (hundreds of thousands to ~1M tokens — a body the model itself would refuse) and a question; the zoo's leCore memory spills the corpus so the model reads only a few thousand tokens. Returns the answer plus the receipt (`billedUsd`, `
|
|
82
|
+
- **`zoo_ask`** — `{prompt, corpus?, model?, max_tokens?}`. The flagship: hand it a *huge* `corpus` (hundreds of thousands to ~1M tokens — a body the model itself would refuse) and a question; the zoo's leCore memory spills the corpus so the model reads only a few thousand tokens. Returns the answer plus the receipt (`billedUsd`, `directUsd`, `savedUsd`, tokens actually read). An MCP-capable agent can delegate a giant-context question without touching its own model config.
|
|
83
83
|
- **`zoo_models`** — list the zoo's models and pricing (free).
|
|
84
84
|
- **`zoo_wallet`** — funding address, balances, and this session's receipts.
|
|
85
85
|
|
|
@@ -93,7 +93,7 @@ Builds a ~965k-token document with one planted fact, shows that buying direct re
|
|
|
93
93
|
|
|
94
94
|
```
|
|
95
95
|
bound once in 14.8s: 3.7MB → context ctx_01KZZY8YQE…
|
|
96
|
-
quote for the ask: $0.000480 · pricing=markup
|
|
96
|
+
quote for the ask: $0.000480 · pricing=markup · at OpenRouter price (the 3.7MB corpus is not re-priced)
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
If the wallet is funded with USDC or TOKEN it pays (capped at `OPENZOO_DEMO_MAX_USD`, default $0.01) and prints the answer, the tokens the model actually read, and the receipt. If not, it prints exactly what to fund. Long waits (the one-time upload, pricing, payment, the answer) show a live progress line with stage + elapsed seconds.
|
|
@@ -111,7 +111,7 @@ If the wallet is funded with USDC or TOKEN it pays (capped at `OPENZOO_DEMO_MAX_
|
|
|
111
111
|
The zoo keeps your corpus in leCore holographic memory; the shim keeps a manifest at `~/.openzoo/contexts.json` (chmod 600) mapping `sha256(corpus)` → the zoo's `context_id`, scoped per API base. When a request carries a corpus the manifest already knows:
|
|
112
112
|
|
|
113
113
|
- **nothing big is uploaded** — the ask ships alone with an `X-HRR-Context` header,
|
|
114
|
-
- **the 402 prices the tiny ask** (
|
|
114
|
+
- **the 402 prices the tiny ask** at OpenRouter rates (read `extra.billedUsd`), typically a few hundredths of a cent instead of re-pricing megabytes,
|
|
115
115
|
- **the answer still comes from your corpus** — the zoo recalls the relevant slices server-side.
|
|
116
116
|
|
|
117
117
|
This works in all three fronts: the **proxy** (a big pasted body in the last message is split at its last blank line, bound once, and reused on every later call — even with a different question), the **MCP** `zoo_ask` `corpus` parameter, and the **demo**. If the zoo ever forgets a context (sidecar wipe), the gateway answers 404 *before* any payment and the shim transparently re-binds once and retries — a stale manifest never fails a call.
|
|
@@ -175,11 +175,11 @@ Pin the key with `OPENZOO_TUNNEL_TOKEN` if your IDE stores it. Keys never leave
|
|
|
175
175
|
## Honest pricing note
|
|
176
176
|
|
|
177
177
|
Two bases, reported per call in the 402 (`extra.pricing`):
|
|
178
|
-
- **
|
|
179
|
-
- **Big bodies price at a counterfactual discount** (~10× cheaper than buying the same call direct) — the zoo's leCore memory means it never forwards your whole body upstream, and passes the savings on. Measured numbers at [benches.openzoo.fun](https://benches.openzoo.fun).
|
|
180
|
-
- **Asks against a bound corpus price on the small forwarded body
|
|
178
|
+
- **Wallet path charges OpenRouter prices.** There is no 3× markup. If the caller saves vs sending the same body direct, zoo takes 33% of the savings. Short prompts have nothing to spill, so you pay the OpenRouter figure, reconciled against the provider's own metered cost after it completes.
|
|
179
|
+
- **Big bodies price at a counterfactual discount** (~10× cheaper than buying the same call direct) — the zoo's leCore memory means it never forwards your whole body upstream, and passes most of the savings on. Measured numbers at [benches.openzoo.fun](https://benches.openzoo.fun).
|
|
180
|
+
- **Asks against a bound corpus price on the small forwarded body.** That is not a discount trick: a few hundred tokens at OpenRouter rates is far below the counterfactual price of shipping the corpus, which is the whole point of binding once.
|
|
181
181
|
|
|
182
|
-
The receipt names which base you got; `extra.directUsd` / `extra.
|
|
182
|
+
The receipt names which base you got; `extra.billedUsd` / `extra.directUsd` / `extra.savedUsd` let you check the math. (Card subscription pricing is a different path.)
|
|
183
183
|
|
|
184
184
|
## Payment rails
|
|
185
185
|
|
package/lib/demo.js
CHANGED
|
@@ -120,7 +120,10 @@ export async function runDemo() {
|
|
|
120
120
|
}
|
|
121
121
|
const accept = pickAccept(quote, config.token);
|
|
122
122
|
const x = accept.extra || {};
|
|
123
|
-
|
|
123
|
+
const saved = x.savedUsd != null ? Number(x.savedUsd)
|
|
124
|
+
: (x.directUsd != null ? Math.max(0, Number(x.directUsd) - Number(x.billedUsd)) : 0);
|
|
125
|
+
const saveBit = saved > 0 ? ` · $${saved.toFixed(6)} saved vs direct` : ' · at OpenRouter price';
|
|
126
|
+
console.log(` quote for the ask: $${Number(x.billedUsd).toFixed(6)} · pricing=${x.pricing}${saveBit} (the ${docMb}MB corpus is not re-priced)`);
|
|
124
127
|
console.log('');
|
|
125
128
|
|
|
126
129
|
if (Number(x.billedUsd) > config.demoMaxUsd) {
|