Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claudeor

claudeor

Run Claude Code against OpenRouter for one session, without touching your Claude subscription login.

Hit your Pro or Max quota mid-task? Quit, run claudeor -c, and carry on with the same conversation on any of ~300 tool-capable models from ~40 vendors, paid per token through OpenRouter. Plain claude stays exactly as it was.

Pick a model on OpenRouter, use plain claude on the subscription, then continue that session on OpenRouter

claudeor                      # default model on OpenRouter
claudeor -c                   # continue this directory's last session on OpenRouter
claudeor opus                 # short alias
claudeor qwen/qwen3-coder-next
claudeor --pick               # fuzzy-search the live catalogue, then launch
claudeor --pick glm --by price
claudeor-models kimi          # browse without launching
claudeor-vendors

Install

curl -fsSL https://raw.githubusercontent.com/Steveybrown/claudeor/main/install.sh | sh

Then open a new shell and run claudeor-key to store your OpenRouter API key in Keychain (macOS) or libsecret (Linux). Without a keychain, export OPENROUTER_API_KEY=... in your profile works and always wins when set.

Requires zsh, jq, curl and git. fzf is optional but makes --pick far better. The installer clones to ~/.claudeor and adds one source line to ~/.zshrc; rerun it to update. To do that by hand:

git clone https://github.com/Steveybrown/claudeor ~/.claudeor
echo 'source ~/.claudeor/claudeor.zsh' >> ~/.zshrc

Commands

Command What it does
claudeor [model] [claude args] Launch Claude Code on OpenRouter. model is an alias or any OpenRouter id. Everything after it goes to claude, so -c, --resume <id>, -p "..." all work.
claudeor --pick [query] [--by KEY] Choose from the live catalogue, then launch. fzf fuzzy search with a description preview when installed, otherwise a vendor-first numbered menu.
claudeor --list Show the alias table.
claudeor-models [query] [--by KEY] [--refresh] Print the catalogue: id, vendor, context, price per million tokens in and out, release date, think / vision flags.
claudeor-vendors Vendors with model counts and newest release.
claudeor-key Store or replace the OpenRouter key.

KEY is date (default, newest first), price, ctx, vendor or name.

The catalogue is OpenRouter's public model list, filtered to models that support tool calling (Claude Code cannot work without it) and excluding batch endpoints. It is cached for a day.

Configuration

Set these in your shell profile before the source line.

Variable Default Purpose
CLAUDEOR_DEFAULT sonnet Alias or id used when no model is given.
CLAUDEOR_MODELS see file zsh associative array of alias to id. Defaults use OpenRouter's rolling ~vendor/family-latest ids, so they track new releases. Define your own to replace the table.
CLAUDEOR_SORT date Default sort for listings and the picker.
CLAUDEOR_BIN ~/.local/bin/claude, else claude on PATH Claude Code binary.
CLAUDEOR_KEYCHAIN_SERVICE openrouter-api-key Keychain / libsecret entry name.
CLAUDEOR_CACHE ~/.cache/claudeor/models.v2.json Catalogue cache location.
CLAUDEOR_CACHE_TTL 86400 Cache lifetime in seconds.
CLAUDEOR_SETTINGS ~/.claude/settings.json Claude Code user settings, where the model default is restored.

How it works

claudeor sets the OpenRouter gateway variables on one launched process only. Claude Code prefers a gateway token over the saved claude.ai login but leaves that login in place, so plain claude is untouched. No /logout, unlike OpenRouter's guide.

It also smooths over four Claude Code behaviours (v2.1.260):

  • Maps fable, opus, sonnet and haiku to OpenRouter ids, so built-in aliases, plan mode and background calls keep working.
  • Passes the model's real context length, since unknown models are otherwise assumed to be 200k and compacted early.
  • Restores your model default on exit, because /model saves its pick globally and would break plain claude.
  • Turns Remote Control off for the session, because it fails on non-Anthropic hosts.

Limitations

  • No Remote Control on OpenRouter sessions. Use tmux if you need remote access.
  • /model lists a curated shortlist, not the catalogue. Use --pick, or type any id as /model <id>.
  • "isn't described by this version's model catalog" prints for non-Claude models. Ignore it.
  • /cost shows nothing useful. Check the OpenRouter dashboard.
  • The exit hint claude --resume <id> reopens on your subscription. Use claudeor <model> --resume <id>.
  • "Supports tools" is the only filter. Weak models are still weak.
  • zsh only.

Default aliases use OpenRouter's rolling ~vendor/family-latest ids. If one ever disappears, claudeor --list marks it and launching through it warns.

License

MIT

About

Claude Code, routed through OpenRouter on demand

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages