Skip to main content

A tool to manage OpenRouter integration with Claude Code.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_openrouter_tool-0.2.1.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_openrouter_tool-0.2.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file claude_openrouter_tool-0.2.1.tar.gz.

File metadata

File hashes

Hashes for claude_openrouter_tool-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3d2d97da5274eab802e84bb4c6b9e0221b429d6178bba6f6320fb9995994d77a
MD5 12df060384b61f9543b541756bee55e1
BLAKE2b-256 35d7508402b748045208d09e23de7609811c22a4556e2902e58eccf1d4d50595

See more details on using hashes here.

File details

Details for the file claude_openrouter_tool-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_openrouter_tool-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2cba9a79b85775112c14421041e0e0387542f02160ab64a202a40fb1d4f72618
MD5 e46ee9816e829bad9ac07d0b3da4b9aa
BLAKE2b-256 820081c22f4c0f9015cc1b6fabcb05759fcb1dd979c671500ff83f41ba0451f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page