Skip to main content

Claude OpenRouter Tool

CI PyPI version Python

Command-line utility for OpenRouter integration with Claude Code. Automates installation and configuration of @musistudio/claude-code-router npm package.

Installation is simple:

pipx install claude-openrouter-tool

Requirements

  • Python 3.9+
  • Node.js/npm
  • OpenRouter API key

Commands

setup

claude-openrouter-tool setup

Interactive configuration wizard. Performs npm verification, package installation, API key input, model selection, and configuration file creation.

check

claude-openrouter-tool check

Validates npm installation, router package status, configuration file structure, and API key functionality.

update

claude-openrouter-tool update

Updates @musistudio/claude-code-router to latest version.

config

claude-openrouter-tool config

Interactive configuration management. Supports viewing settings, editing API keys, managing models, and setting defaults.

models

claude-openrouter-tool models [OPTIONS]

Fetch and display available models from OpenRouter API.

Options:

  • --category TEXT - Filter models by category (e.g., programming)
  • --limit INTEGER - Limit number of models displayed
  • --free - Show only free models
  • --json - Output as JSON format

Examples:

# List all available models
claude-openrouter-tool models

# Show only free models
claude-openrouter-tool models --free

# Filter by programming category with limit
claude-openrouter-tool models --category programming --limit 10

# JSON output for scripting
claude-openrouter-tool models --free --json

Supported Models

Model Parameters Application
deepseek/deepseek-r1:free 671B Complex reasoning (default)
deepseek/deepseek-v3-0324:free 685B MoE General coding
qwen/qwen-2.5-coder-32b-instruct:free 32B Code generation
Llama/Mistral variants Various Lightweight operations

Configuration

File location: ~/.claude-code-router/config.json

{
  "Providers": [{
    "name": "openrouter",
    "api_base_url": "https://openrouter.ai/api/v1/chat/completions",
    "api_key": "sk-or-...",
    "models": ["deepseek/deepseek-r1:free"]
  }],
  "Router": {
    "default": "openrouter,deepseek/deepseek-r1:free"
  }
}

Usage

  1. Install: pipx install claude-openrouter-tool
  2. Obtain API key: OpenRouter.ai
  3. Configure: claude-openrouter-tool setup
  4. Verify: claude-openrouter-tool check

Model Management

Discovering Available Models

Browse all available models from OpenRouter:

# View all available models
claude-openrouter-tool models

# Find free models for development
claude-openrouter-tool models --free

# Search programming-focused models
claude-openrouter-tool models --category programming

Adding Models to Configuration

Add models via the interactive configuration menu:

claude-openrouter-tool config

Popular model additions:

  • anthropic/claude-3-haiku:beta
  • google/gemini-pro-1.5
  • openai/gpt-4o-mini

Change default model via "Set Default Model" menu option.

Integration

Router package proxies API requests to OpenRouter. Configured models appear automatically in Claude Code interface.

Troubleshooting

Issues and Solutions

Problem Solution
npm not found Install Node.js from nodejs.org, verify PATH
Permission denied Use sudo npm install -g @musistudio/claude-code-router
Invalid API key Verify sk-or-... format, check account credits
Configuration missing Execute claude-openrouter-tool setup
Models not visible Verify package status, restart Claude Code

Diagnostics

claude-openrouter-tool check

Reports npm status, package version, configuration validity, and API key functionality.

References

Alternative Commands

ortool-claude setup|check|config|update|models

Development

Technology Stack

  • Python 3.9+, Click framework
  • pytest with pexpect testing
  • uv package management

Environment Setup

git clone https://github.com/belyak/claude-open-router-tool.git
cd claude-open-router-tool
uv sync --extra dev

Testing

uv run pytest

Architecture Components

  • JSON configuration management
  • Automated npm package handling
  • Interactive CLI with inquirer prompts
  • Comprehensive validation system

Metadata

Release files for claude-openrouter-tool 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claude-openrouter-tool 0.2.1
File Size Uploaded
claude_openrouter_tool-0.2.1.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for claude-openrouter-tool 0.2.1
File Interpreter ABI Platform
claude_openrouter_tool-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 28.6 kB

Release files / claude_openrouter_tool-0.2.1.tar.gz

Download URL claude_openrouter_tool-0.2.1.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3d2d97da5274eab802e84bb4c6b9e0221b429d6178bba6f6320fb9995994d77a
BLAKE2b-256 checksum
How to use checksums
35d7508402b748045208d09e23de7609811c22a4556e2902e58eccf1d4d50595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release files / claude_openrouter_tool-0.2.1-py3-none-any.whl

Download URL claude_openrouter_tool-0.2.1-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cba9a79b85775112c14421041e0e0387542f02160ab64a202a40fb1d4f72618
BLAKE2b-256 checksum
How to use checksums
820081c22f4c0f9015cc1b6fabcb05759fcb1dd979c671500ff83f41ba0451f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page