openzoo 0.33.1 → 0.33.2

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 +25 -14
  2. package/package.json +1 -1
package/lib/launch.js CHANGED
@@ -71,17 +71,31 @@ export async function launchClaude(argv) {
71
71
  const wantDesktop = argv.includes('--desktop');
72
72
  const terminal = !wantDesktop;
73
73
  const rest = argv.filter((a) => !['--terminal', '-t', '--desktop'].includes(a));
74
- const env = {
75
- ...process.env,
76
- ANTHROPIC_BASE_URL: base,
77
- ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY || 'sk-openzoo',
78
- ANTHROPIC_AUTH_TOKEN: process.env.ANTHROPIC_AUTH_TOKEN || 'sk-openzoo',
79
- };
74
+ // GATEWAY AUTH, NOT API-KEY. Setting ANTHROPIC_API_KEY makes Claude Code bill
75
+ // api.anthropic.com and it TAKES PRECEDENCE over ANTHROPIC_BASE_URL — observed:
76
+ // "Both ... set · auth may not work" + "API Usage Billing", never hitting the
77
+ // zoo. A custom gateway uses BASE_URL + AUTH_TOKEN only; API_KEY must be UNSET
78
+ // (including any inherited one) or it wins.
79
+ const env = { ...process.env };
80
+ delete env.ANTHROPIC_API_KEY;
81
+ env.ANTHROPIC_BASE_URL = base;
82
+ env.ANTHROPIC_AUTH_TOKEN = process.env.ANTHROPIC_AUTH_TOKEN || 'sk-openzoo';
80
83
 
81
84
  if (terminal) {
82
85
  const cli = resolveClaudeCli();
83
86
  if (!cli) { console.error('openzoo: `claude` CLI not found on PATH — install Claude Code, or drop --terminal for the desktop app'); process.exit(1); }
84
- console.error(`openzoo: Claude Code (terminal) on the zoo every turn pays x402`);
87
+ // A CLEAR banner BEFORE Claude Code takes the screen, so it is obvious this
88
+ // session routes through the zoo (the terminal title then shows live spend).
89
+ let wallet = '';
90
+ try { const { PayClient } = await import('./pay.js'); wallet = new PayClient().address; } catch { /* optional */ }
91
+ console.error('');
92
+ console.error(' \x1b[38;5;208m●\x1b[0m openzoo — this Claude Code session routes through the zoo');
93
+ console.error(` endpoint : ${base}`);
94
+ console.error(' auth : gateway token (ANTHROPIC_API_KEY unset — no api.anthropic.com billing)');
95
+ if (wallet) console.error(` wallet : ${wallet}`);
96
+ console.error(' spend : shown live in the terminal title bar; receipts in ~/.openzoo/proxy.log');
97
+ console.error(' every turn pays x402.');
98
+ console.error('');
85
99
  const child = spawn(cli, rest, { stdio: 'inherit', env });
86
100
  child.on('exit', (c) => process.exit(c ?? 0));
87
101
  child.on('error', (e) => { console.error(`openzoo: could not launch claude: ${e.message}`); process.exit(1); });
@@ -130,13 +144,10 @@ export async function launchHarness(cmd, args) {
130
144
  process.exit(1);
131
145
  }
132
146
 
133
- const env = {
134
- ...process.env,
135
- ANTHROPIC_BASE_URL: base,
136
- ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY || 'sk-openzoo',
137
- // Claude Code sends model ids like "claude-opus-5"; the zoo serves those,
138
- // and unknown ids are matched to the nearest served model regardless.
139
- };
147
+ const env = { ...process.env };
148
+ delete env.ANTHROPIC_API_KEY; // conflicts with the gateway auth-token path
149
+ env.ANTHROPIC_BASE_URL = base;
150
+ env.ANTHROPIC_AUTH_TOKEN = process.env.ANTHROPIC_AUTH_TOKEN || 'sk-openzoo';
140
151
  console.error(`openzoo: launching \`${cmd}\` on the zoo (ANTHROPIC_BASE_URL=${base}) — every turn pays x402`);
141
152
  const child = spawn(cmd, args, { stdio: 'inherit', env });
142
153
  child.on('exit', (code) => process.exit(code ?? 0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.33.1",
3
+ "version": "0.33.2",
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",