@blockrun/cc 0.3.0 → 0.4.1

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.
@@ -0,0 +1 @@
1
+ export declare function modelsCommand(): Promise<void>;
@@ -0,0 +1,42 @@
1
+ import chalk from 'chalk';
2
+ import { loadChain, API_URLS } from '../config.js';
3
+ export async function modelsCommand() {
4
+ const chain = loadChain();
5
+ const apiUrl = API_URLS[chain];
6
+ console.log(chalk.bold('Available Models\n'));
7
+ console.log(`Chain: ${chalk.magenta(chain)} — ${chalk.dim(apiUrl)}\n`);
8
+ try {
9
+ const response = await fetch(`${apiUrl}/v1/models`);
10
+ if (!response.ok) {
11
+ console.log(chalk.red(`Failed to fetch models: ${response.status}`));
12
+ return;
13
+ }
14
+ const data = (await response.json());
15
+ const models = data.data
16
+ .sort((a, b) => (a.pricing?.input ?? 0) - (b.pricing?.input ?? 0));
17
+ const free = models.filter((m) => m.billing_mode === 'free');
18
+ const paid = models.filter((m) => m.billing_mode !== 'free');
19
+ if (free.length > 0) {
20
+ console.log(chalk.green.bold('Free Models (no USDC needed)'));
21
+ console.log(chalk.dim('─'.repeat(70)));
22
+ for (const m of free) {
23
+ console.log(` ${chalk.cyan(m.id)}`);
24
+ }
25
+ console.log('');
26
+ }
27
+ console.log(chalk.yellow.bold('Paid Models'));
28
+ console.log(chalk.dim('─'.repeat(70)));
29
+ console.log(chalk.dim(` ${'Model'.padEnd(35)} ${'Input'.padEnd(12)} ${'Output'.padEnd(12)} Context`));
30
+ console.log(chalk.dim('─'.repeat(70)));
31
+ for (const m of paid) {
32
+ const input = `$${(m.pricing?.input ?? 0).toFixed(2)}/M`;
33
+ const output = `$${(m.pricing?.output ?? 0).toFixed(2)}/M`;
34
+ const ctx = '';
35
+ console.log(` ${chalk.cyan(m.id.padEnd(35))} ${input.padEnd(12)} ${output.padEnd(12)} ${ctx}`);
36
+ }
37
+ console.log(`\n${chalk.dim(`${models.length} models available. Use:`)} ${chalk.bold('brcc start --model <model-id>')}`);
38
+ }
39
+ catch (err) {
40
+ console.log(chalk.red(`Error: ${err instanceof Error ? err.message : 'Failed to fetch models'}`));
41
+ }
42
+ }
@@ -1,5 +1,6 @@
1
1
  interface StartOptions {
2
2
  port?: string;
3
+ model?: string;
3
4
  launch?: boolean;
4
5
  }
5
6
  export declare function startCommand(options: StartOptions): Promise<void>;
@@ -16,13 +16,16 @@ export async function startCommand(options) {
16
16
  }
17
17
  const port = parseInt(options.port || String(DEFAULT_PROXY_PORT));
18
18
  const shouldLaunch = options.launch !== false;
19
+ const model = options.model;
19
20
  console.log(chalk.bold('brcc — BlockRun Claude Code\n'));
20
21
  console.log(`Chain: ${chalk.magenta('solana')}`);
21
22
  console.log(`Wallet: ${chalk.cyan(wallet.address)}`);
23
+ if (model)
24
+ console.log(`Model: ${chalk.green(model)}`);
22
25
  console.log(`Proxy: ${chalk.cyan(`http://localhost:${port}`)}`);
23
26
  console.log(`Backend: ${chalk.dim(apiUrl)}\n`);
24
27
  const server = createProxy({ port, apiUrl, chain: 'solana' });
25
- launchServer(server, port, shouldLaunch);
28
+ launchServer(server, port, shouldLaunch, model);
26
29
  }
27
30
  else {
28
31
  const wallet = getOrCreateWallet();
@@ -34,26 +37,35 @@ export async function startCommand(options) {
34
37
  }
35
38
  const port = parseInt(options.port || String(DEFAULT_PROXY_PORT));
36
39
  const shouldLaunch = options.launch !== false;
40
+ const model = options.model;
37
41
  console.log(chalk.bold('brcc — BlockRun Claude Code\n'));
38
42
  console.log(`Chain: ${chalk.magenta('base')}`);
39
43
  console.log(`Wallet: ${chalk.cyan(wallet.address)}`);
44
+ if (model)
45
+ console.log(`Model: ${chalk.green(model)}`);
40
46
  console.log(`Proxy: ${chalk.cyan(`http://localhost:${port}`)}`);
41
47
  console.log(`Backend: ${chalk.dim(apiUrl)}\n`);
42
48
  const server = createProxy({ port, apiUrl, chain: 'base' });
43
- launchServer(server, port, shouldLaunch);
49
+ launchServer(server, port, shouldLaunch, model);
44
50
  }
45
51
  }
46
- function launchServer(server, port, shouldLaunch) {
52
+ function launchServer(server, port, shouldLaunch, model) {
47
53
  server.listen(port, () => {
48
54
  console.log(chalk.green(`Proxy running on port ${port}\n`));
49
55
  if (shouldLaunch) {
50
56
  console.log('Starting Claude Code...\n');
51
- const claude = spawn('claude', [], {
57
+ const cleanEnv = { ...process.env };
58
+ delete cleanEnv.CLAUDE_ACCESS_TOKEN;
59
+ delete cleanEnv.CLAUDE_OAUTH_TOKEN;
60
+ const claudeArgs = [];
61
+ if (model)
62
+ claudeArgs.push('--model', model);
63
+ const claude = spawn('claude', claudeArgs, {
52
64
  stdio: 'inherit',
53
65
  env: {
54
- ...process.env,
66
+ ...cleanEnv,
55
67
  ANTHROPIC_BASE_URL: `http://localhost:${port}/api`,
56
- ANTHROPIC_API_KEY: 'brcc',
68
+ ANTHROPIC_API_KEY: 'sk-ant-api03-brcc-proxy-00000000000000000000000000000000000000000000-00000000000000',
57
69
  },
58
70
  });
59
71
  claude.on('error', (err) => {
@@ -75,7 +87,7 @@ function launchServer(server, port, shouldLaunch) {
75
87
  else {
76
88
  console.log('Proxy-only mode. Set this in your shell:\n');
77
89
  console.log(chalk.bold(` export ANTHROPIC_BASE_URL=http://localhost:${port}/api`));
78
- console.log(chalk.bold(` export ANTHROPIC_API_KEY=brcc`));
90
+ console.log(chalk.bold(` export ANTHROPIC_API_KEY=sk-ant-api03-brcc-proxy-00000000000000000000000000000000000000000000-00000000000000`));
79
91
  console.log(`\nThen run ${chalk.bold('claude')} in another terminal.`);
80
92
  }
81
93
  });
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import { Command } from 'commander';
3
3
  import { setupCommand } from './commands/setup.js';
4
4
  import { startCommand } from './commands/start.js';
5
5
  import { balanceCommand } from './commands/balance.js';
6
+ import { modelsCommand } from './commands/models.js';
6
7
  const program = new Command();
7
8
  program
8
9
  .name('brcc')
@@ -16,8 +17,13 @@ program
16
17
  .command('start')
17
18
  .description('Start proxy and launch Claude Code')
18
19
  .option('-p, --port <port>', 'Proxy port', '8402')
20
+ .option('-m, --model <model>', 'Model to use (e.g. openai/gpt-5.4, nvidia/gpt-oss-120b)')
19
21
  .option('--no-launch', 'Start proxy only, do not launch Claude Code')
20
22
  .action(startCommand);
23
+ program
24
+ .command('models')
25
+ .description('List available models and pricing')
26
+ .action(modelsCommand);
21
27
  program
22
28
  .command('balance')
23
29
  .description('Check wallet USDC balance')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/cc",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Run Claude Code with any model — no rate limits, no account locks, no phone verification. Pay per use with USDC.",
5
5
  "type": "module",
6
6
  "bin": {