Skip to content

Use Claude Code as a single interface to access multiple AI providers with intent-based routing for optimal performance and cost.

License

Notifications You must be signed in to change notification settings

halilertekin/CC-RouterMultiProvider

Repository files navigation

Claude Code Router Config - Advanced Multi-Provider Setup

🚀 v2.0.9 - Unified router + config package with z.ai (GLM 4.7) support, advanced CLI tools, analytics, smart routing, and configuration templates!

Use Claude Code as a single interface to access multiple AI providers with intelligent routing for optimal performance, cost, and quality.

✨ New in v2.0.9

  • glm/glm-ccr print mode disables attachments to avoid EMFILE (too many open files) watcher errors.

Includes all v2.0.8 improvements:

  • UI üzerinden .env anahtarları ekleme/güncelleme (TR/NL).
  • ~/.env otomatik yükleme ile API anahtarlarının bulunması (CLI + health monitor).
  • z.ai Support: Native integration for GLM-4.7 via z.ai (PPInfra).
  • Lightweight Mode: New ccc function for zero-dependency routing.
  • Direct GLM Alias: glm now launches GLM-4.7 directly via z.ai; glm-ccr keeps router mode.
  • Non-interactive install: CI-friendly installer flags and env controls.
  • Unified router: Built-in router service, no external dependency required.
  • UI refresh: Daha sade ve responsive tasarım, TR/NL dil desteği.

🚀 Setup on Another Machine (Fastest Way)

If you just want to use the ccc command (Claude Code Commander) and glm alias without installing the full Node.js router stack:

  1. Clone the repo:

    mkdir -p ~/code
    git clone git@github.com:halilertekin/CC-RouterMultiProvider.git ~/code/claude-code-router-config
  2. Source the script in your .zshrc: Add this line to your ~/.zshrc:

    [[ -f "$HOME/code/claude-code-router-config/cli/ccc.zsh" ]] && source "$HOME/code/claude-code-router-config/cli/ccc.zsh"
  3. Configure Keys: Create ~/.env or ~/.ccm_config with your keys:

    export GLM_API_KEY="your_zai_key_here"
    export DEEPSEEK_API_KEY="your_deepseek_key_here"
  4. Reload & Run:

    source ~/.zshrc
    glm        # Launches GLM-4.7 via z.ai (direct)
    glm-ccr    # Launches GLM-4.7 via local router
    ccc ds     # Launches DeepSeek
    ccc claude # Launches Official Claude (Pro)

Features

  • Node.js 16+ Support: Compatible with modern Node.js environments
  • 7 Provider Support: OpenAI, Anthropic, Gemini, Qwen, GLM, OpenRouter, GitHub Copilot
  • Smart Intent-Based Routing: Automatically selects the best model based on your request
  • Advanced CLI Tools: Test, benchmark, analyze, and monitor your setup
  • Analytics & Cost Tracking: Detailed insights into usage and spending
  • Configuration Templates: Pre-optimized setups for different use cases
  • Health Monitoring: Real-time provider status and automatic failover
  • Enhanced Logging: Detailed logs with metrics and performance data

Routing Strategy

Request Type Provider Model
Code writing, debugging OpenAI gpt-4o
Deep analysis, architecture Anthropic claude-sonnet-4
Quick responses, summaries Gemini gemini-2.5-flash
Simple tasks Qwen qwen-plus
Translation, multilingual GLM glm-4.7 (z.ai)
Complex algorithms OpenAI o1
Coding assistance GitHub Copilot copilot

Installation (Full Router)

Option 1: PNPM (Recommended)

Use this if you want the full routing capabilities (benchmarking, analytics, etc).

pnpm add -g @halilertekin/claude-code-router-config
# System is ready! Run: ccr --help

Then run the installer to copy config files:

ccr-setup

Non-interactive usage (CI):

CCR_CONFIG_NO_PROMPT=1 ccr-setup
CCR_CONFIG_OVERWRITE=1 ccr-setup
# or
ccr-setup --overwrite

Option 2: Manual Setup

1. Copy Configuration Files

mkdir -p ~/.claude-code-router
cp config/config.json ~/.claude-code-router/
cp config/intent-router.js ~/.claude-code-router/
cp config/smart-intent-router.js ~/.claude-code-router/

2. Set Up Environment Variables

Create .env file:

cp .env.example ~/.env
# Edit ~/.env with your API keys

3. Start Router

source ~/.zshrc
node router/server.js

API Key Setup

Provider Link Notes
OpenAI https://platform.openai.com/api-keys gpt-4o, o1 models
Anthropic https://console.anthropic.com/settings/keys Claude models
Gemini https://aistudio.google.com/apikey Google AI models
Qwen https://dashscope.console.aliyun.com/apiKey Alibaba Cloud
GLM (z.ai) https://open.bigmodel.cn/usercenter/apikeys Zhipu AI / z.ai
OpenRouter https://openrouter.ai/keys Multiple models
GitHub Copilot https://github.com/settings/tokens copilot scope

Configuration Templates

Template Best For Priority Cost Speed
performance-optimized Real-time apps, chatbots Speed Low ⭐⭐⭐⭐⭐
cost-optimized Budget-conscious, bulk processing Cost ⭐⭐⭐⭐⭐ ⭐⭐⭐
quality-focused Critical tasks, research Quality High ⭐⭐
development Coding, debugging Coding Medium ⭐⭐⭐⭐
balanced General use Balanced Medium ⭐⭐⭐⭐
# Quick template selection
ccr config template performance-optimized  # Fastest
ccr config template cost-optimized           # Cheapest
ccr config template quality-focused          # Best quality

Analytics Dashboard

View comprehensive analytics via:

# Web Dashboard (if enabled)
ccr ui

# CLI Analytics
ccr analytics today --detailed

Metrics tracked:

  • Request volume and patterns
  • Cost per provider/model
  • Response times and latency
  • Success/error rates
  • Provider health status

Documentation

Provider Setup / Sağlayıcı Kurulumu 🆕

📖 Read the Provider Setup Guide for:

  • How to add multiple providers (OpenRouter, OpenAI, Gemini, Qwen)
  • Inter-provider routing with automatic fallback
  • Cost optimization strategies (up to 87% savings!)
  • Configuration examples and troubleshooting

🔗 Hızlı Provider Ekleme:

Provider Get API Key Cost (1M tokens)
GLM (z.ai) Sign Up ~$0.50 ⭐
Qwen Sign Up ~$0.10
Gemini Sign Up ~$0.01
OpenAI Sign Up ~$2.50
OpenRouter Sign Up Variable
# Add to ~/.env
export GLM_API_KEY="your_key_here"
export OPENROUTER_API_KEY="your_key_here"
export GEMINI_API_KEY="your_key_here"

# Verify setup
ccr status --detailed
ccr test glm
ccr benchmark --all

License

MIT © Halil Ertekin


🌟 Show Your Support

If you find this useful, please give it a ⭐ on GitHub!

About

Use Claude Code as a single interface to access multiple AI providers with intent-based routing for optimal performance and cost.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published