Skip to main content

claude-or

Route Claude Code through OpenRouter to alternative models. One command, zero config files.

Quick Start

1. Install

# From GitHub
pipx install 'claude-or @ git+https://github.com/iagochavarry/claude-or.git'

# Or with pip
pip install 'claude-or @ git+https://github.com/iagochavarry/claude-or.git'

2. Configure

Create a .env file (in your working directory or ~/.claude-or/.env):

OPENROUTER_API_KEY=sk-or-v1-your-key-here

3. Run

Full mode (proxy + Claude Code):

claude-or

Proxy only (start proxy in background):

claude-or --proxy-only
# Then in another terminal:
claude-or --claude-only

Claude only (connect to existing proxy):

claude-or --claude-only

Pass additional flags to Claude Code:

claude-or -- --debug --allowed-tools Bash,Read

Headless mode (single prompt, no TUI):

claude-or -- -p "Explain this codebase"

Quickly understand any codebase:

claude-or -- -p "Explain this codebase"

That's it. All Claude model requests are now routed through OpenRouter.

Configuration

All configuration is via environment variables or .env file:

Variable Default Description
OPENROUTER_API_KEY required Your OpenRouter API key
CLAUDE_SONNET_MODEL openrouter/moonshotai/kimi-k2.5 Backend for Sonnet requests
CLAUDE_OPUS_MODEL openrouter/moonshotai/kimi-k2.5 Backend for Opus requests
CLAUDE_HAIKU_MODEL openrouter/moonshotai/kimi-k2.5 Backend for Haiku requests
OPENROUTER_PROVIDER Together Provider pinning (empty = no pinning)
CLAUDE_OR_PORT 4000 Proxy port

CLI Flags

claude-or -p 4001           # custom port
claude-or -v                # verbose logging
claude-or --proxy-only      # proxy only, no Claude launch
claude-or --claude-only     # Claude only, connect to existing proxy
claude-or -- --debug        # pass --debug to Claude Code

How It Works

Claude Code sends requests to http://localhost:4000 thinking it's talking to Anthropic's API. The proxy (powered by LiteLLM) translates the request format and routes it to your configured model on OpenRouter.

Claude Code → localhost:4000 → LiteLLM Proxy → OpenRouter → Your Model

Why LiteLLM?

  • Translates between Anthropic message format and OpenAI chat format
  • drop_params silently discards Anthropic-specific fields that would cause errors
  • Provider pinning ensures consistent backend quality
  • Production-grade, actively maintained

.env File Lookup Order

  1. .env in current working directory
  2. ~/.claude-or/.env
  3. Shell environment variables

Shell env vars always take precedence over .env files.

Metadata

Release files for claude-or 0.1.0

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-or 0.1.0
File Size Uploaded
claude_or-0.1.0.tar.gz 17.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for claude-or 0.1.0
File Interpreter ABI Platform
claude_or-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.2 kB

Release files / claude_or-0.1.0.tar.gz

Download URL claude_or-0.1.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c0cfd4eec7bef1f101d8d227e4680614c006d655368a52a7945dc8c7f4940c3f
BLAKE2b-256 checksum
How to use checksums
e5dc16e4553890024cc566157f2a60b62a539e92d7f54b6b3a17d77c5be07a3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / claude_or-0.1.0-py3-none-any.whl

Download URL claude_or-0.1.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c1409d1c68f228a76bbfb5495a91b26c04774e515c46300b5aeb58da37d1380
BLAKE2b-256 checksum
How to use checksums
ee0a6bc6e55f2ef84bf87eb52a5ecbbdf4e533a2953f5f25060b33756ea928e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

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