openzoo 0.48.41 → 0.48.43

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.
Files changed (2) hide show
  1. package/lib/launch.js +68 -0
  2. package/package.json +1 -1
package/lib/launch.js CHANGED
@@ -143,6 +143,40 @@ export async function launchClaude(argv) {
143
143
  delete env.ANTHROPIC_API_KEY;
144
144
  env.ANTHROPIC_BASE_URL = base;
145
145
  env.ANTHROPIC_AUTH_TOKEN = process.env.ANTHROPIC_AUTH_TOKEN || 'sk-openzoo';
146
+ // STOP CLAUDE CODE COMPACTING ON A WINDOW THAT IS NOT REAL.
147
+ //
148
+ // It counts the WHOLE local transcript and compacts against a window it looks
149
+ // up from the MODEL NAME — hardcoded 200k for a recognised Claude id, which is
150
+ // why `/autocompact 1m` answered "capped to 200k by model" and why raising
151
+ // CLAUDE_CODE_MAX_CONTEXT_TOKENS alone did nothing. It never sees that the
152
+ // proxy binds the prefix and forwards ~8 of 166 turns.
153
+ //
154
+ // An `openzoo-` alias is the same model upstream (models.js resolves by
155
+ // SUFFIX, so openzoo-claude-sonnet-5 -> anthropic/claude-sonnet-5) but is not
156
+ // in that table, so the client falls back to the advertised context_length —
157
+ // which this gateway publishes as 128,000,000.
158
+ //
159
+ // OPENZOO_NO_ALIAS=1 opts out. Worth knowing: model-specific client behaviour
160
+ // (thinking budget, tool formats) also keys off the name, so if a session
161
+ // behaves oddly this is the first thing to turn off.
162
+ // Applies to WHATEVER model you are on — opus, fable, sonnet, haiku. The
163
+ // 200k table is keyed by name, so every recognised Claude id hits it; the
164
+ // alias is minted from the requested model rather than pinned to sonnet.
165
+ if (process.env.OPENZOO_NO_ALIAS !== '1') {
166
+ const want = process.env.OPENZOO_CLAUDE_ALIAS
167
+ || process.env.ANTHROPIC_MODEL
168
+ || 'claude-sonnet-5';
169
+ // idempotent: never openzoo-openzoo-…; strip a vendor prefix so the SUFFIX
170
+ // resolver in models.js gets the bare family name it matches on.
171
+ const bare = String(want).replace(/^openzoo-/, '').replace(/^[^/]+\//, '');
172
+ // ONLY families whose alias was VERIFIED to resolve back to themselves.
173
+ // openzoo-claude-haiku-4-5 resolved to deepseek/deepseek-v4-pro-0813 — the
174
+ // suffix scorer found no haiku in the catalog and picked a neighbour, so
175
+ // aliasing it would silently swap the user's model. A compaction fix is
176
+ // never worth answering as a different model than the one asked for.
177
+ const SAFE = /^claude-(opus|sonnet|fable)-/;
178
+ if (SAFE.test(bare)) env.ANTHROPIC_MODEL = `openzoo-${bare}`;
179
+ }
146
180
  // RAISE THE CEILING, because the proxy already removed it.
147
181
  //
148
182
  // Claude Code counts the WHOLE local transcript against the model's window and
@@ -360,6 +394,40 @@ export async function launchHarness(cmd, args) {
360
394
  delete env.ANTHROPIC_API_KEY; // conflicts with the gateway auth-token path
361
395
  env.ANTHROPIC_BASE_URL = base;
362
396
  env.ANTHROPIC_AUTH_TOKEN = process.env.ANTHROPIC_AUTH_TOKEN || 'sk-openzoo';
397
+ // STOP CLAUDE CODE COMPACTING ON A WINDOW THAT IS NOT REAL.
398
+ //
399
+ // It counts the WHOLE local transcript and compacts against a window it looks
400
+ // up from the MODEL NAME — hardcoded 200k for a recognised Claude id, which is
401
+ // why `/autocompact 1m` answered "capped to 200k by model" and why raising
402
+ // CLAUDE_CODE_MAX_CONTEXT_TOKENS alone did nothing. It never sees that the
403
+ // proxy binds the prefix and forwards ~8 of 166 turns.
404
+ //
405
+ // An `openzoo-` alias is the same model upstream (models.js resolves by
406
+ // SUFFIX, so openzoo-claude-sonnet-5 -> anthropic/claude-sonnet-5) but is not
407
+ // in that table, so the client falls back to the advertised context_length —
408
+ // which this gateway publishes as 128,000,000.
409
+ //
410
+ // OPENZOO_NO_ALIAS=1 opts out. Worth knowing: model-specific client behaviour
411
+ // (thinking budget, tool formats) also keys off the name, so if a session
412
+ // behaves oddly this is the first thing to turn off.
413
+ // Applies to WHATEVER model you are on — opus, fable, sonnet, haiku. The
414
+ // 200k table is keyed by name, so every recognised Claude id hits it; the
415
+ // alias is minted from the requested model rather than pinned to sonnet.
416
+ if (process.env.OPENZOO_NO_ALIAS !== '1') {
417
+ const want = process.env.OPENZOO_CLAUDE_ALIAS
418
+ || process.env.ANTHROPIC_MODEL
419
+ || 'claude-sonnet-5';
420
+ // idempotent: never openzoo-openzoo-…; strip a vendor prefix so the SUFFIX
421
+ // resolver in models.js gets the bare family name it matches on.
422
+ const bare = String(want).replace(/^openzoo-/, '').replace(/^[^/]+\//, '');
423
+ // ONLY families whose alias was VERIFIED to resolve back to themselves.
424
+ // openzoo-claude-haiku-4-5 resolved to deepseek/deepseek-v4-pro-0813 — the
425
+ // suffix scorer found no haiku in the catalog and picked a neighbour, so
426
+ // aliasing it would silently swap the user's model. A compaction fix is
427
+ // never worth answering as a different model than the one asked for.
428
+ const SAFE = /^claude-(opus|sonnet|fable)-/;
429
+ if (SAFE.test(bare)) env.ANTHROPIC_MODEL = `openzoo-${bare}`;
430
+ }
363
431
  // RAISE THE CEILING, because the proxy already removed it.
364
432
  //
365
433
  // Claude Code counts the WHOLE local transcript against the model's window and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.48.41",
3
+ "version": "0.48.43",
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",