nous-token 0.3.3 → 0.3.4

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/cli/setup.ts CHANGED
@@ -240,7 +240,8 @@ if (configured > 0) {
240
240
  console.log(" \x1b[1mAll terminals (permanent):\x1b[0m");
241
241
  const shell = process.env.SHELL || "/bin/bash";
242
242
  const rcFile = shell.includes("zsh") ? "~/.zshrc" : "~/.bashrc";
243
- console.log(` \x1b[36mecho '${cmds.join("\\n")}' >> ${rcFile} && source ${rcFile}\x1b[0m\n`);
243
+ const echoCmd = cmds.map(c => `echo '${c}' >> ${rcFile}`).join(" && ");
244
+ console.log(` \x1b[36m${echoCmd} && source ${rcFile}\x1b[0m\n`);
244
245
  console.log(` See your usage at \x1b[4mhttps://token.nousai.cc\x1b[0m`);
245
246
  } else {
246
247
  console.log(" No AI tools found. Install Claude Code, Cursor, or any OpenAI-compatible tool.");
package/index.ts CHANGED
@@ -57,10 +57,13 @@ export default function plugin(api: OpenClawPluginApi): void {
57
57
  if (cfg.customProviders) {
58
58
  for (const [name, { upstream, envVar, api: apiType }] of Object.entries(cfg.customProviders)) {
59
59
  registerProvider(api, name, {
60
- baseUrl: `${GATEWAY}${walletSegment}/v1`,
60
+ // Custom providers can't use /provider/w/wallet/ path (no provider prefix to strip).
61
+ // Wallet is sent via X-Nous-Wallet header instead.
62
+ baseUrl: `${GATEWAY}/v1`,
61
63
  apiType: apiType || "openai-completions",
62
64
  envVars: [envVar],
63
65
  upstreamHeader: upstream,
66
+ walletHeader: wallet,
64
67
  });
65
68
  }
66
69
  }
@@ -75,7 +78,7 @@ export default function plugin(api: OpenClawPluginApi): void {
75
78
  function registerProvider(
76
79
  api: OpenClawPluginApi,
77
80
  providerKey: string,
78
- opts: { baseUrl: string; apiType: string; envVars: string[]; upstreamHeader?: string }
81
+ opts: { baseUrl: string; apiType: string; envVars: string[]; upstreamHeader?: string; walletHeader?: string }
79
82
  ): void {
80
83
  const nousId = `nous-${providerKey}`;
81
84
 
@@ -123,6 +126,7 @@ function registerProvider(
123
126
  ...params.headers,
124
127
  "x-nous-user": keyHash,
125
128
  ...(opts.upstreamHeader ? { "x-nous-upstream": opts.upstreamHeader } : {}),
129
+ ...(opts.walletHeader ? { "x-nous-wallet": opts.walletHeader } : {}),
126
130
  };
127
131
  return inner(params);
128
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nous-token",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Open-source AI usage tracker. One command to track all your AI spending.",
5
5
  "type": "module",
6
6
  "main": "index.ts",