Skip to main content

Claude OpenRouter

Put your OpenRouter favorites directly in Claude Code's /model picker.

PyPI version Python versions MIT license

Installing Claude OpenRouter, searching OpenRouter models, and adding favorites to Claude Code

Claude OpenRouter is a small, dependency-free CLI. It indexes OpenRouter's live model catalog, gives you a searchable multi-select picker, and writes your favorites into Claude Code's native /model menu. There is no local proxy, background service, or replacement harness.

Install

curl -LsSf https://xhluca.github.io/claude-openrouter/install.sh | sh

The installer prompts for your OpenRouter key without echoing it, fetches the current catalog, and opens the model picker immediately. It installs for the current user on Linux or macOS.

Or use uv:

uv tool install claude-openrouter
clor setup

For a one-off setup without installing the package first:

uvx claude-openrouter setup

pipx install claude-openrouter works too. The full command is claude-openrouter; clor is the shorthand. Claude Code 2.1.242 or newer is required for the multi-model picker.

Quick start

Refresh the local catalog:

clor index

fetch is an alias for index. index is the canonical name because the result is a persistent local catalog used by selection and search.

Search refreshes the index first. Plain terms are case-insensitive substring globs; *, ?, and bracket expressions use shell-style matching:

clor search claude
clor search 'anthropic/*' '*coder*'
clor search --regex '^(anthropic|google)/.*(sonnet|gemini)'

Select one exact model, several exact models, or open the interactive picker:

clor select anthropic/claude-sonnet-4.6
clor select --model openai/gpt-5.4
clor select --models anthropic/claude-opus-4.6 google/gemini-3.1-pro-preview
clor select

The positional value is shorthand for --model. Each non-interactive call replaces the saved favorite set. In the picker, type a search and press Enter, use the arrow keys, press Enter or Space to select and deselect, / to search again, and s to save.

Restart Claude Code, then switch normally:

> /model

The selected rows are Claude Code's native picker rows, and requests use the OpenRouter key stored by this tool.

Commands

Command Purpose
clor index Fetch and cache the current OpenRouter model catalog
clor fetch Alias for index
clor search QUERY... Refresh, then search names, IDs, and descriptions
clor setup Run the install-time key and model setup again
clor select [MODEL] Replace /model favorites exactly
clor config Replace and validate the stored OpenRouter key
clor reset Restore the original Claude settings and delete tool data
clor uninstall Reset the integration and remove a curl/uv installation

Every catalog command also accepts --json where useful. API keys are never accepted as command-line arguments; automation can pipe one to setup --key-stdin or config --key-stdin.

What it changes

OpenRouter API → local model index → selected favorites → Claude Code /model
  • Stores the key at ~/.config/claude-openrouter/credential with mode 0600.
  • Adds a tiny apiKeyHelper to Claude Code, so the key is not copied into ~/.claude/settings.json.
  • Sets Claude Code's API base URL to OpenRouter's native Anthropic-compatible endpoint and clears higher-precedence Anthropic key/token variables inside Claude Code so the helper is selected.
  • Writes selected models through Claude Code's user-level modelPicker setting.
  • Backs up only the settings fields it owns and preserves unrelated settings.

Claude Code is optimized for Anthropic models. OpenRouter can accept other model IDs through its Anthropic-compatible endpoint, but models differ in tool use, thinking blocks, context handling, and Claude Code compatibility. Prefer models that OpenRouter documents as suitable for agentic tool use.

Reset and uninstall

Restore the pre-install Claude settings while keeping the command:

clor reset

Restore settings, remove the credential and index, and uninstall a curl/uv tool installation:

clor uninstall

Demo

The animation above is rendered from a real asciinema capture of the installed CLI and the native Claude Code TUI: hidden key entry, live catalog indexing, glob search, interactive multi-selection, and the resulting /model rows. It uses a deliberately fake credential only to read OpenRouter's public catalog; it makes no inference request. The prompt is not echoed, and the scripts reject any cast containing a key-shaped string before publishing it. The only post-processing replaces the randomized temporary home path with ~.

Watch the MP4 or reproduce the capture.

Development

git clone https://github.com/xhluca/claude-openrouter.git
cd claude-openrouter
uv run --with pytest pytest
uv run --with ruff ruff check .

License

MIT

Acknowledgements

Claude Code Router (CCR) helped establish the broader Claude Code routing space. CCR is a full, self-contained routing and UI-based management system spanning providers, profiles, routing rules, and more. Claude OpenRouter is intentionally narrower: it is a simple connection from Claude Code to OpenRouter, installs with one small Bash command (or uv/uvx), and does not aim to cover CCR's full management spectrum.

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-0.1.0.tar.gz (314.1 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-0.1.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file claude_openrouter-0.1.0.tar.gz.

File metadata

  • Download URL: claude_openrouter-0.1.0.tar.gz
  • Upload date:
  • Size: 314.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for claude_openrouter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7313d8de5ca7a7a643b9dde8bf16268b79b730fbb4f16613652fddb240c62287
MD5 893b7982ab4c7a47197b2d407f29a40e
BLAKE2b-256 483c4ec0052b9044736a4ff20b37df9459b9f37f02803992b2df7a14cfbc14f4

See more details on using hashes here.

File details

Details for the file claude_openrouter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_openrouter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f31faa0721eea06b4a13fb4066006a7b0deacb502197456842d3c992e44520f7
MD5 f7c778ad70c6311bd9cdc7975e6d55aa
BLAKE2b-256 5aa5c8aca54dfca7ae2d24a4abbeed7e81cc565d4b3652eb5cb164866c181226

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

2 files

0.2.0

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

Supported by

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