solrouter 0.4.4 → 0.4.5

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/bin/proxy.js +12 -0
  2. package/package.json +1 -1
package/bin/proxy.js CHANGED
@@ -136,6 +136,16 @@ async function main() {
136
136
  const passThru = rest.filter((a, i) =>
137
137
  !["--port", "--mode"].includes(a) && !["--port", "--mode"].includes(rest[i - 1]));
138
138
  const tool = process.env.SOLROUTER_TOOL || "claude";
139
+ // CRITICAL: Claude Code only routes to a custom ANTHROPIC_BASE_URL when an API
140
+ // key is present — otherwise a Max/Pro subscription silently bypasses the base
141
+ // URL and talks to Anthropic directly (so the proxy never sees the traffic).
142
+ // Force API-key mode by giving the child a key. The proxy's frontier leg uses
143
+ // its own configured key regardless, so this only needs to be non-empty.
144
+ const childKey = cfg.frontier.apiKey || process.env.ANTHROPIC_API_KEY || "sk-ant-solrouter-proxy";
145
+ if (!cfg.frontier.apiKey && !process.env.ANTHROPIC_API_KEY) {
146
+ console.warn("Warning: no Anthropic API key configured — Claude Code on a subscription may bypass the proxy.");
147
+ console.warn("Run `solrouter setup` and paste an API key so requests route through the proxy.\n");
148
+ }
139
149
  console.log(`\nLaunching ${tool} through the proxy (ANTHROPIC_BASE_URL=http://127.0.0.1:${cfg.port})…\n`);
140
150
  const child = spawn(tool, passThru, {
141
151
  stdio: "inherit",
@@ -143,6 +153,8 @@ async function main() {
143
153
  ...process.env,
144
154
  ANTHROPIC_BASE_URL: `http://127.0.0.1:${cfg.port}`,
145
155
  OPENAI_BASE_URL: `http://127.0.0.1:${cfg.port}/v1`,
156
+ ANTHROPIC_API_KEY: childKey, // forces Claude Code to use the base URL
157
+ CLAUDE_CODE_USE_BEDROCK: "",
146
158
  },
147
159
  });
148
160
  child.on("error", e => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solrouter",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Local privacy router for coding tools: pseudonymises every request before it leaves your machine, and sends work a frontier model would refuse to an uncensored open-weight model you control.",
5
5
  "type": "module",
6
6
  "bin": {