Claude OpenRouter
Use OpenRouter models in Claude Code without giving up your native login or connectors.
Claude OpenRouter is a small, dependency-free CLI. It indexes OpenRouter's live
model catalog, gives you a searchable multi-select picker, and adds those
favorites to Claude Code's native /model menu. There is no local proxy,
background service, replacement harness, or alternate launcher: after setup,
run the normal claude command.
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. If a credential already exists, setup shows its path and asks whether to reuse it before offering a masked replacement prompt.
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.
Upgrade the installation in place at any time:
clor update
The updater uses the manager that owns the current installation and reports
the installed version before and after. clor upgrade is an alias. When moving
from 0.2.x to 0.3.x, run clor setup once after the update to activate the new
plain-claude integration.
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 Down or
Enter to browse its results. Press Enter or Space to select and deselect; press
Up past the first result or Esc to focus the search again. Press s while
browsing results, or Shift-S/Ctrl-S while typing a search, to save.
Launch Claude Code normally, then switch models normally:
claude
> /model
The selected rows are Claude Code's native picker rows, and model requests use
the OpenRouter key stored by this tool. Every local Claude Code entry point reads
the same settings, including claude --continue, claude --agent NAME,
background agents, and the claude agents view.
When you are logged in through claude.ai, Claude Code keeps that native
authentication for Claude.ai connectors while a custom request header routes
model calls to OpenRouter. The old external-auth warning is therefore absent.
Without a native login, Claude.ai connectors are unavailable; manually
configured MCP servers continue to work.
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 claude [ARGS...] |
Compatibility alias for claude [ARGS...] |
clor update |
Install the latest release and report the version change |
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/credentialwith mode0600. - Adds the picker, OpenRouter API base, and an Authorization header to
~/.claude/settings.json, then restricts that file to mode0600because it contains the key. - With a native Claude.ai login, does not set
ANTHROPIC_API_KEY,ANTHROPIC_AUTH_TOKEN, orapiKeyHelper, so Claude Code retains that login and its connectors. Without one, it usesANTHROPIC_AUTH_TOKENas a fallback. - Saves the fields it replaces in a private, versioned backup and restores them
exactly with
clor resetorclor uninstall. - Migrates settings created by older claude-openrouter releases automatically the next time setup or selection runs.
Claude Code applies one endpoint to an entire process, not to individual
/model rows. Consequently, the configured picker contains OpenRouter-routed
favorites rather than a mixture of native-billed and OpenRouter-routed rows.
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 in real time from an end-to-end asciinema
capture: the public curl installer, progressively masked key entry, a live
OpenRouter search for z-ai/glm-5.3-flash, exact selection, Claude Code's
native /model picker launched through plain claude, and a real model response.
The scripts verify the saved assistant turn and reject any cast containing the
credential before publishing it. Sanitization replaces the randomized temporary
path with ~; release-only command, settings-path, and version labels may be
rebased without altering the captured Claude interaction or model response.
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_openrouter-0.3.0.tar.gz.
File metadata
- Download URL: claude_openrouter-0.3.0.tar.gz
- Upload date:
- Size: 630.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97a8381005aaf6bc29dbecae1fbb70914879804e442b63df20889150ac399d6a
|
|
| MD5 |
c8cacaf92bc72929ddd07179537c8fb2
|
|
| BLAKE2b-256 |
4ae46dab195bd8c568bf42dc1b43d1c7470d30bd1c1a056632efd30c0900ab58
|
File details
Details for the file claude_openrouter-0.3.0-py3-none-any.whl.
File metadata
- Download URL: claude_openrouter-0.3.0-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fdf6cd1d545da923b77a3cf4449de9c2a62e9bec2684ab55180998e5d440338
|
|
| MD5 |
3c03dfa22093a5a3f2e23978d30dd617
|
|
| BLAKE2b-256 |
0b0652ed19ab635fdeba8b6459e07705e6c467998326b75aea98fc78b9a8229b
|