Setting Up Claude Code to Work with OpenRouter Using Claude Code Router

Table of contents
Claude Code Router (CCR) is a lightweight CLI-based code interpreter and dev assistant interface designed for local LLM routing. It supports multiple model providers, including OpenRouter, and allows dynamic model selection for tasks like coding, thinking, and long-context interactions.
If you want to use Claude Code with OpenRouter models like Qwen3 Coder or Kimi-K2 Pro this guide walks you through the setup.
Prerequisites
Node.js (v18+)
A working terminal or shell (e.g., bash, zsh)
An OpenRouter API key (from https://openrouter.ai)
Note that you must have bought at least $10 credits to be able to use even the :free quoted model.
Find the entire configuration on https://claudecoderouter.com/, although I must admit, I’ve spent close to a week going around circles trying to work it out, which nearly made me want to tear off my face 😵.
That’s when I came across AI Oriented Dev's youtube video, shoutout to him 🙌.
I discovered one key difference in how he approached it:
Before using Claude for coding help, it is to make sure to start the local router service:
claude start
Here is the complete installation process:
- Install Claude Code Router
npm install -g @musistudio/claude-code-router
Configure the
config.json
file which needs to be located at~/.claude-code-router
. You are required to create it, if not present already.Here is the exact
config.json
file I’m using:
{
"Providers": [
{
"name": "openrouter",
"api_base_url": "https://openrouter.ai/api/v1/chat/completions",
"api_key": "sk-openrouter-api-key",
"models": [
"anthropic/claude-3.5-sonnet",
"google/gemini-2.5-pro-preview",
"moonshotai/kimi-k2",
"qwen/qwen3-coder:free"
],
"transformer": {
"use": ["openrouter"]
}
}
],
"Router": {
"default": "openrouter,qwen/qwen3-coder:free",
// "default": "openrouter,qwen/qwen3-coder",
// "default": "openrouter,moonshotai/kimi-k2",
// "default": "openrouter,moonshotai/kimi-k2:free",
"background": "openrouter,qwen/qwen3-coder:free",
"think": "openrouter,qwen/qwen3-coder:free",
"longContext": "openrouter,qwen/qwen3-coder:free"
},
"API_TIMEOUT_MS": 600000,
"LOG": true
}
You might want to add the additionals fields:
API_TIMEOUT_MS=60000
, which sets the timeout duration to 60,000ms, or 10 minutes for API requests. It is particularly useful when using slow or large models, which may take longer for complex completions.
LOG=true
, which enables logging.
- Start the local router service. This is the step that made all the difference, and it’s somehow now mentioned in the documentation as of this moments
claude start
- Once the router is up and running, you can jump into coding mode:
claude code
And voila, it's working as expected!
That’s it from me! Let me know if you run into any issues- I’ve probably hit the same ones 😄
Cheers!
Subscribe to my newsletter
Read articles from Abhishek Patil directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
