🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@openrouter/cli

Package Overview
Dependencies
Maintainers
5
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openrouter/cli - npm Package Compare versions

Comparing version
0.0.19
to
1.0.0-pr-10990.442bfe2
dist/cli

Sorry, the diff of this file is not supported yet

+61
-35
{
"name": "@openrouter/cli",
"version": "0.0.19",
"description": "Use OpenRouter to access Claude Code using any model, and more!",
"version": "1.0.0-pr-10990.442bfe2",
"description": "SDK DevTools and utilities for OpenRouter development",
"type": "module",
"files": [
"dist/cli",
"README.md",
"LICENSE",
"package.json"
],
"bin": {
"openrouter": "./dist/cli.js"
"openrouter": "./dist/cli"
},
"scripts": {
"build": "bun run scripts/build.ts",
"build": "bun scripts/build.ts",
"build:devtools": "vite build --config src/devtools/vite.config.ts",
"dev": "bun run src/cli.ts",
"dev:devtools": "vite --config src/devtools/vite.config.ts",
"lint": "biome check",
"release": "cd ../.. && pnpm tsx scripts/release-cli.ts",
"tag": "VERSION=$(node -e \"console.log(require('./package.json').version)\") && git tag v$VERSION && git push origin v$VERSION",
"test": "bun test",
"test:watch": "bun test --watch",
"release": "bun run build && bun publish",
"tag": "VERSION=$(node -e \"console.log(require('./package.json').version)\") && git tag v$VERSION && git push origin v$VERSION"
"test:watch": "bun test --watch"
},
"keywords": [
"claude",
"code",
"router",
"llm",
"anthropic",
"openrouter"
],
"author": "openrouter",
"license": "SEE LICENSE IN LICENSE",
"files": [
"dist/cli.js",
"dist/tiktoken_bg.wasm",
"README.md",
"LICENSE",
"package.json"
],
"dependencies": {
"@hono/node-server": "^1.19.2",
"@openrouter/devtools": "workspace:*",
"hono": "^4.9.6",
"vaul": "^1.1.2"
},
"devDependencies": {
"@openrouter/sdk": "0.1.3",
"@radix-ui/colors": "^3.0.0",
"@radix-ui/react-collapsible": "^1.1.2",
"@radix-ui/react-scroll-area": "^1.2.2",
"@radix-ui/react-slot": "^1.1.1",
"@radix-ui/react-tooltip": "^1.1.8",
"@tailwindcss/typography": "^0.5.16",
"@types/bun": "^1.2.21",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.21",
"biome": "^0.3.3",
"openurl": "^1.1.1",
"bun": "latest",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"date-fns": "4.1.0",
"dotenv": "^16.6.1",
"@types/bun": "^1.2.21",
"@types/node": "^24.3.1",
"bun": "latest",
"@hono/node-server": "^1.19.2",
"@openrouter/sdk": "0.1.3",
"enquirer": "^2.4.1",
"hono": "^4.9.6",
"json5": "^2.2.3",
"lucide-react": "^0.469.0",
"openurl": "^1.1.1",
"pino-rotating-file-stream": "^0.0.2",
"tiktoken": "^1.0.22",
"postcss": "^8.5.6",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwind-merge": "^3.4.0",
"tailwind-scrollbar-hide": "^2.0.0",
"tailwindcss": "^3.4.16",
"tailwindcss-animate": "^1.0.7",
"typescript": "^5.9.2",
"uuid": "^11.1.0",
"zod": "^3.25.76",
"typescript": "^5.9.2"
"vite": "^6.0.7",
"windy-radix-palette": "^2.0.0-beta.7",
"zod": "^3.25.76"
},

@@ -59,3 +75,13 @@ "publishConfig": {

]
}
},
"keywords": [
"claude",
"code",
"router",
"llm",
"anthropic",
"openrouter"
],
"author": "openrouter",
"license": "SEE LICENSE IN LICENSE"
}
+63
-125

@@ -1,69 +0,80 @@

# OpenRouter CLI
# OpenRouter DevTools CLI
> A powerful command-line interface for OpenRouter, enabling seamless integration with multiple language models and AI services. Currently featuring Claude Code integration with more capabilities coming soon.
> SDK DevTools and utilities for OpenRouter development
## ✨ Features
[![npm version](https://badge.fury.io/js/%40openrouter%2Fcli.svg)](https://www.npmjs.com/package/@openrouter/cli)
- **Multi-Model Support**: Access any model available on OpenRouter through a unified interface
- **Claude Code Integration**: Use any OpenRouter model with Claude Code for enhanced development workflows
- **Smart Model Routing**: Automatically route requests to optimal models based on task type (reasoning, long context, web search, etc.)
- **Dynamic Model Switching**: Change models on-the-fly using simple commands
- **Extensible Architecture**: Built to support future OpenRouter features and integrations
## Features
## 🚀 Getting Started
- 📊 **SDK DevTools Viewer** - Visualize OpenRouter SDK telemetry in a beautiful web UI
- 📈 **StatusLine Integration** - Claude Code statusline showing model and token usage
### 1. Installation
## Installation
Install the OpenRouter CLI:
```shell
```bash
npm install -g @openrouter/cli
```
For Claude Code integration, ensure you have [Claude Code](https://docs.anthropic.com/en/docs/claude-code/quickstart) installed:
## Commands
```shell
npm install -g @anthropic-ai/claude-code
### DevTools Viewer
Launch the SDK DevTools viewer to visualize telemetry:
```bash
openrouter devtools
```
### 2. Configuration
Opens web UI at http://localhost:4983
Create and configure your `~/.openrouter/claude-code-proxy.json` file. For more details, see "Example Configuration" below.
**Setup:**
The configuration file supports several key sections:
1. Install devtools in your project:
```bash
npm install @openrouter/devtools
```
- **`OPENROUTER_API_KEY`**: Your OpenRouter API key for accessing models
- **`LOG`** (optional): Enable/disable logging. Default is `true`
- **`LOG_LEVEL`** (optional): Set logging verbosity: `"fatal"`, `"error"`, `"warn"`, `"info"`, `"debug"`, `"trace"`. Default is `"debug"`
- **Logging Systems**: The OpenRouter CLI uses two separate logging systems:
- **Server logs**: HTTP requests and API events in `~/.openrouter/logs/`
- **Application logs**: Routing decisions and operations in `~/.openrouter/router.log`
- **`models`**: Configure model routing for different task types
- **`API_TIMEOUT_MS`**: API call timeout in milliseconds
2. Initialize SDK with devtools hooks:
```typescript
import { createOpenRouterDevtools } from '@openrouter/devtools';
import { OpenRouter } from '@openrouter/sdk';
#### Environment Variable Support
const sdk = new OpenRouter({
apiKey: process.env.OPENROUTER_API_KEY,
hooks: createOpenRouterDevtools()
});
```
The OpenRouter CLI supports environment variable interpolation for secure credential management. Reference environment variables in your config using `$VAR_NAME` or `${VAR_NAME}` syntax:
3. Run your app - telemetry is captured to `.devtools/`
```json
{
"OPENROUTER_API_KEY": "$OPENROUTER_API_KEY"
}
4. Launch viewer:
```bash
openrouter devtools
```
### StatusLine
For Claude Code users, add a statusline showing model and token usage:
```bash
openrouter statusline
```
Keep sensitive credentials secure by storing them as environment variables rather than in configuration files.
Configure in Claude Code settings to display:
- Current directory
- Git branch
- Model name
- Input/output tokens
#### Example Configuration
## Configuration
Optional config at `~/.openrouter/claude-code-proxy.json`:
```json
{
"OPENROUTER_API_KEY": "$OPENROUTER_API_KEY",
"LOG": true,
"models": {
"default": "deepseek/deepseek-chat",
"background": "qwen/qwen3-30b-a3b",
"think": "deepseek/deepseek-reasoner",
"longContext": "google/gemini-2.5-pro-preview",
"longContextThreshold": 60000,
"webSearch": "google/gemini-2.5-flash:online"
"LOG_LEVEL": "debug",
"DEVTOOLS_PORT": 4983,
"StatusLine": {
"currentStyle": "default"
}

@@ -73,91 +84,18 @@ }

### 3. Usage
## Development
#### Claude Code Integration
Use any OpenRouter model with Claude Code:
```shell
openrouter code "your prompt here"
```
#### Service Management
```shell
openrouter proxy start # Start the proxy service
openrouter proxy stop # Stop the proxy service
openrouter proxy restart # Restart the service (required after config changes)
openrouter proxy status # Check service status
```
### 4. Model Routing
Configure intelligent model routing based on task requirements:
- **`default`**: Primary model for general tasks
- **`background`**: Cost-efficient model for background operations
- **`think`**: Advanced reasoning model for complex problem-solving
- **`longContext`**: Model optimized for large context windows (>60K tokens)
- **`longContextThreshold`**: Token threshold for automatic long-context routing (default: 60000)
- **`webSearch`**: Model with web search capabilities (append `:online` to model name)
#### Dynamic Model Selection
Switch models on-the-fly within Claude Code:
```shell
/model anthropic/claude-sonnet-4
```
## Developing
### Installation
Make sure you have bun.
```
```bash
bun install
bun run build
bun test
```
### Running locally
## Migration from v0.x
All `openrouter` commands above via `npm dev`:
**Breaking change:** v1.0.0 removes all proxy functionality (start/stop/restart/code commands).
```
bun run dev proxy start
bun run dev proxy status
bun run dev code
bun run dev proxy stop
```
See [MIGRATION.md](./MIGRATION.md) for details.
### Testing your built package locally with npm
## License
```
bun run build
bun pm pack
# local npm install
cd /path/to/somewhere
npm uninstall @openrouter/cli
npm install /path/to/cli/openrouter-cli-version-number.tgz
node_modules/.bin/openrouter proxy start
node_modules/.bin/openrouter code
# global npm install
npm uninstall -g @openrouter/cli
npm install -g /path/to/cli/openrouter-cli-version-number.tgz
openrouter proxy start
openrouter code
```
## 🚧 Coming Soon
The OpenRouter CLI is actively expanding to support:
- Direct model querying/chat
- Ability to intercept all calls on your system to openai or anthropic through your openai account to use any model
- API usage monitoring and analytics
- Account management
- And much more!
Stay tuned for updates as we build out the complete OpenRouter experience.
SEE LICENSE IN LICENSE

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet