### Example: Connect iFlow Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md Specific steps to connect iFlow. ```text 1. Click "Connect iFlow" 2. Login with iFlow account 3. Authorize 4. ✅ Done! Use 8 models: `if/kimi-k2-thinking`, `if/qwen3-coder-plus`, etc. ``` -------------------------------- ### API Key Format Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/zh-CN/getting-started/installation.md Example format of an API key. ```text 9r_1234567890abcdef1234567890abcdef ``` -------------------------------- ### Cost Optimization Strategy Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md A real-world example of optimizing costs for 100M tokens per month using a combination of free, subscription, cheap, and emergency models. ```text Real example (100M tokens/month): 60M via Gemini CLI: $0 (free tier) 30M via Claude Code: $0 (subscription you already have) 8M via GLM: $4.80 2M via MiniMax: $0.40 Total: $5.20/month + existing subscriptions ``` -------------------------------- ### Start 9Router (Local) Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/installation.md Command to start 9Router after local installation using npx. ```bash npx 9router ``` -------------------------------- ### MiniMax M2.1 Setup: Get API Key Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md Steps to get an API key from MiniMax. ```bash Dashboard → API Management → Create Key → Copy API key ``` -------------------------------- ### Example: Connect GLM-4.7 Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md Specific steps to connect GLM-4.7 using an API key. ```text 1. Sign up at [Zhipu AI](https://open.bigmodel.cn/) 2. Get API key from Coding Plan 3. Dashboard → Add API Key → Provider: `glm` → Paste key 4. ✅ Done! Use model: `glm/glm-4.7` ``` -------------------------------- ### Installation and Start Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/index.md Commands to install 9Router globally using npm and start the service, which automatically opens a dashboard. ```bash # Install globally npm install -g 9router # Start (dashboard opens automatically) 9router ``` -------------------------------- ### Example: Connect Claude Code Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md Specific steps to connect Claude Code using OAuth. ```text 1. Click "Connect Claude Code" 2. Login with your Claude account 3. Authorize 9Router 4. ✅ Done! Use model: `cc/claude-opus-4-5-20251101` ``` -------------------------------- ### Kimi K2 Setup - Step 4: Use in CLI Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/cheap.md Example CLI command to specify the Kimi model. ```bash Model: kimi/kimi-latest ``` -------------------------------- ### Kimi K2 Setup: Get API Key Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md Steps to get an API key from Moonshot AI for Kimi. ```bash Dashboard → API Keys → Create New → Copy API key ``` -------------------------------- ### MiniMax M2.1 Setup - Step 4: Use in CLI Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/cheap.md Example CLI command to specify the MiniMax model. ```bash Model: minimax/MiniMax-M2.1 ``` -------------------------------- ### Example 1: Student/Learner (Zero Budget) Source: https://github.com/decolua/9router/blob/master/gitbook/content/es/providers/free.md Configuration and cost breakdown for a zero-budget setup ideal for students. ```text Configuración: 1. kr/claude-sonnet-4.5 (Mejor calidad) 2. if/kimi-k2-thinking (Razonamiento complejo) 3. qw/qwen3-coder-plus (Codificación rápida) Costo mensual: $0 Uso: Ilimitado Perfecto para: - Aprender a programar - Proyectos personales - Tareas/asignaciones ``` -------------------------------- ### VPS/Cloud Server Installation and Configuration Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/installation.md Install, configure environment variables, and start 9router on a server using PM2. ```bash # Install npm install -g 9router # Configure export JWT_SECRET="your-secure-secret" export INITIAL_PASSWORD="your-password" export NODE_ENV="production" # Start with PM2 npm install -g pm2 pm2 start 9router --name 9router pm2 save pm2 startup ``` -------------------------------- ### Deploy to VPS Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/faq.md Steps to clone the repository, install dependencies, build the project, and start the application on a VPS. ```bash git clone https://github.com/decolua/9router.git cd 9router/app npm install && npm run build npm start ``` -------------------------------- ### Install 9Router Globally Source: https://github.com/decolua/9router/blob/master/README.md Install the 9Router CLI tool globally using npm. After installation, simply run '9router' to start the dashboard. ```bash npm install -g 9router 9router ``` -------------------------------- ### MiniMax M2.1 Setup - Step 2: Get API Key Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/cheap.md Instructions to obtain an API key from the MiniMax dashboard. ```bash Dashboard → API Management → Create Key → Copy API key ``` -------------------------------- ### Headroom Proxy Setup Source: https://github.com/decolua/9router/blob/master/README.md Provides instructions for setting up the Headroom proxy for token saving. This involves installing the library and running the proxy service. ```bash pip install "headroom-ai[proxy]" headroom proxy --port 8787 ``` -------------------------------- ### GLM-4.7 Setup: Get API Key Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md Steps to get an API key from Zhipu AI. ```bash Dashboard → API Keys → Create New → Copy API key (starts with "zhipu-") ``` -------------------------------- ### Installation from Source Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/installation.md Steps to clone the repository, build, and run 9Router from source. ```bash git clone https://github.com/decolua/9router.git cd 9router/app npm install npm run build npm start ``` -------------------------------- ### Environment Variables for Configuration Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/installation.md Example environment variables for configuring 9Router, including security, storage, server, and logging settings. ```bash # Security (REQUIRED in production) export JWT_SECRET="your-secure-secret-change-this" export INITIAL_PASSWORD="your-password" # Storage export DATA_DIR="~/.9router" # Server export PORT="20128" export NODE_ENV="production" # Logging export ENABLE_REQUEST_LOGS="false" ``` -------------------------------- ### Setup PM2 Startup Script Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/deployment/cloud.md Configures PM2 to start automatically when the system boots. ```bash pm2 startup ``` -------------------------------- ### GLM-4.7 Setup - Step 4: Use in CLI Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/cheap.md Example CLI commands to specify GLM models. ```bash Model: glm/glm-4.7 glm/glm-4.6v (vision) ``` -------------------------------- ### Kimi K2 Setup - Step 2: Get API Key Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/cheap.md Instructions to obtain an API key from the Moonshot AI dashboard. ```bash Dashboard → API Keys → Create New → Copy API key ``` -------------------------------- ### Restart Server (Manual) Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/installation.md Commands to stop and start the 9router server manually. ```bash # Stop pkill -f 9router # Start 9router ``` -------------------------------- ### Run 9Router from Source (Development) Source: https://github.com/decolua/9router/blob/master/README.md Set up and run 9Router locally from its source code for development. This involves copying the environment file, installing dependencies, and starting the development server. ```bash cp .env.example .env npm install PORT=20128 NEXT_PUBLIC_BASE_URL=http://localhost:20128 npm run dev ``` -------------------------------- ### Real-World Example: Freelancer (Budget-Conscious) Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/free.md Recommended AI model setup for freelancers balancing cost and performance, utilizing free tiers and cheap backups. ```yaml Setup: 1. gc/gemini-3-flash-preview (FREE 180K/month) 2. glm/glm-4.7 (Cheap backup, $0.6/1M) 3. if/kimi-k2-thinking (FREE fallback) Monthly cost: $5-10 Usage: 100M+ tokens Perfect for: - Client projects (paid tier) - Testing (free tier) - Emergency backup ``` -------------------------------- ### Kimi K2 Quota Reset Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md An example illustrating the monthly token refresh for Kimi. ```bash Monthly reset: 1st of each month → 10M tokens refresh Example monthly usage: Week 1: 3M tokens Week 2: 2M tokens Week 3: 3M tokens Week 4: 2M tokens Total: 10M tokens = $9 flat ``` -------------------------------- ### Setup SSL with Let's Encrypt Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/deployment/cloud.md Commands to install Certbot, obtain an SSL certificate, and test auto-renewal. ```bash # Install certbot sudo apt install certbot python3-certbot-nginx # Obtain SSL certificate sudo certbot --nginx -d your-domain.com # Auto-renewal is configured automatically # Test renewal sudo certbot renew --dry-run ``` -------------------------------- ### GLM-4.7 Setup - Step 2: Get API Key Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/cheap.md Instructions to obtain an API key from the Zhipu AI dashboard. ```bash Dashboard → API Keys → Create New → Copy API key (starts with "zhipu-") ``` -------------------------------- ### Connect Free Providers Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md Steps to connect free providers like iFlow, Qwen, and Kiro using Device code or OAuth. ```text Dashboard → Providers → Connect [Free Provider] → Device code or OAuth → Unlimited usage ``` -------------------------------- ### Configuration Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/integration/cline.md An example of how the Cline settings should appear after configuration. ```text API Provider: Ollama Base URL: http://localhost:20128/v1 API Key: sk-9router-xxxxxxxxxxxxx Model: gpt-4 ``` -------------------------------- ### Real-World Example: Heavy User (Maximize Everything) Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/free.md Recommended AI model setup for heavy users aiming to maximize performance and features by combining free, subscription, and cheap tiers. ```yaml Setup: 1. gc/gemini-3-flash-preview (FREE 180K/month) 2. cc/claude-opus-4-5 (Subscription $20-100) 3. cx/gpt-5.2-codex (Subscription $20-200) 4. glm/glm-4.7 (Cheap $0.6/1M) 5. minimax/MiniMax-M2.1 (Cheapest $0.2/1M) 6. if/kimi-k2-thinking (FREE unlimited) 7. kr/claude-sonnet-4.5 (FREE quality) Monthly cost: $40-320 (subscriptions) + $10-20 (cheap tier) Usage: 500M+ tokens Perfect for: - Professional development - Team projects - 24/7 coding ``` -------------------------------- ### Combo Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/es/features/combos.md Example of a custom combo configuration. ```text Combo Name: premium-coding Models: 1. cc/claude-opus-4-5-20251101 (try first) 2. glm/glm-4.7 (if #1 is out of quota) 3. minimax/MiniMax-M2.1 (if #2 is out of quota) ``` -------------------------------- ### Real-World Example: Student/Learner (Zero Budget) Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/free.md Recommended AI model setup for students or learners with a zero budget, focusing on free, high-quality models. ```yaml Setup: 1. kr/claude-sonnet-4.5 (Best quality) 2. if/kimi-k2-thinking (Complex reasoning) 3. qw/qwen3-coder-plus (Fast coding) Monthly cost: $0 Usage: Unlimited Perfect for: - Learning to code - Personal projects - Homework/assignments ``` -------------------------------- ### Start Application Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/deployment/cloud.md Starts the 9Router application. ```bash npm run start ``` -------------------------------- ### Local Development Installation Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/installation.md Install and run 9router locally for development. ```bash npm install -g 9router 9router ``` -------------------------------- ### Create Combo Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/subscription.md Example of creating a new combo with multiple models. ```bash Dashboard → Combos → Create New Name: premium-coding Models: 1. gc/gemini-3-flash-preview (FREE, use first) 2. cc/claude-opus-4-5-20251101 (Subscription) 3. cx/gpt-5.2-codex (Subscription backup) Use in CLI: premium-coding ``` -------------------------------- ### 9router VPS Deployment Source: https://github.com/decolua/9router/blob/master/README.md Steps to clone, install, configure, and start the 9router application on a Virtual Private Server (VPS). Essential environment variables are provided for production deployment. ```bash # Clone and install git clone https://github.com/decolua/9router.git cd 9router npm install npm run build # Configure export JWT_SECRET="your-secure-secret-change-this" export INITIAL_PASSWORD="your-password" export DATA_DIR="/var/lib/9router" export PORT="20128" export HOSTNAME="0.0.0.0" export NODE_ENV="production" export NEXT_PUBLIC_BASE_URL="http://localhost:20128" export NEXT_PUBLIC_CLOUD_URL="https://9router.com" export API_KEY_SECRET="endpoint-proxy-api-key-secret" export MACHINE_ID_SALT="endpoint-proxy-salt" # Start npm run start # Or use PM2 npm install -g pm2 pm2 start npm --name 9router -- start pm2 save pm2 startup ``` -------------------------------- ### Local Installation Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/installation.md Steps to install 9Router locally within a project directory. ```bash mkdir my-9router cd my-9router npm install 9router ``` -------------------------------- ### Install Nginx Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/deployment/cloud.md Installs the Nginx web server on Ubuntu. ```bash sudo apt update sudo apt install nginx ``` -------------------------------- ### Cursor Settings Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/integration/cursor.md An example of how the Cursor IDE settings should look after configuring 9Router integration. ```text OpenAI API: ✓ Enabled Base URL: https://9router.com API Key: sk-9router-xxxxxxxxxxxxx Custom Models: gpt-4, claude-opus-4-5, gemini-2.0-flash ``` -------------------------------- ### Troubleshooting Application Start Issues Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/deployment/cloud.md Commands to troubleshoot why the application might not be starting, including checking logs, ports, and environment variables. ```bash # Check logs pm2 logs 9router # Check if ports are in use sudo lsof -i :3000 sudo lsof -i :20128 # Check environment variables pm2 env 9router ``` -------------------------------- ### MiniMax M2.1 Quota Reset Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md An example illustrating the 5-hour rolling quota reset for MiniMax. ```bash 5-hour rolling window: → Use quota → Wait 5 hours → Fresh quota Example: 10:00 AM - Use 5M tokens 3:00 PM - Fresh quota available 8:00 PM - Fresh quota available ``` -------------------------------- ### Install and run 9Router via npm Source: https://github.com/decolua/9router/blob/master/cli/README.md Instructions for installing the 9Router CLI globally using npm and running it, including an alternative using npx. ```bash npm install -g 9router 9router # Or run directly with npx npx 9router ``` -------------------------------- ### Creating a Combination Source: https://github.com/decolua/9router/blob/master/gitbook/content/zh-CN/providers/cheap.md Example of setting up a 'cheap-backup' combination in 9Router. ```bash Dashboard → Combinations → New Name: cheap-backup Models: 1. cc/claude-opus-4-5 (Primary Subscription) 2. glm/glm-4.7 (Low-cost fallback, daily reset) 3. minimax/MiniMax-M2.1 (Cheapest fallback) 4. if/kimi-k2-thinking (Free emergency) Usage in CLI: cheap-backup ``` -------------------------------- ### Check Node.js and npm Versions Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/installation.md Commands to verify that the installed Node.js and npm versions meet the requirements. ```bash node --version # Should show v20.x.x or higher npm --version # Should show 10.x.x or higher ``` -------------------------------- ### Run 9Router in Production Mode Source: https://github.com/decolua/9router/blob/master/README.md Build and start 9Router in production mode. This includes building the application and then starting the production server with specified ports and base URL. ```bash npm run build PORT=20128 HOSTNAME=0.0.0.0 NEXT_PUBLIC_BASE_URL=http://localhost:20128 npm run start ``` -------------------------------- ### Troubleshooting: Permission Denied Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/installation.md Instructions to fix npm permissions to resolve permission denied errors during global installation. ```bash # Fix npm permissions (recommended) mkdir ~/.npm-global npm config set prefix '~/.npm-global' echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc source ~/.bashrc # Then install again npm install -g 9router ``` -------------------------------- ### Update 9Router via Local Install Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/faq.md Steps to update 9Router when it was installed locally, involving pulling the latest changes, installing dependencies, building, and starting. ```bash cd 9router/app git pull origin main npm install npm run build npm start ``` -------------------------------- ### Best Practice: Create Smart Combos Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/subscription.md Example of a smart combo configuration. ```bash Example combo: 1. gc/gemini-3-flash-preview (FREE primary) 2. cc/claude-opus-4-5 (Complex tasks) 3. glm/glm-4.7 (Cheap backup) 4. if/kimi-k2-thinking (FREE fallback) ``` -------------------------------- ### Configure Claude Desktop Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md Configuration for Claude Desktop to use 9Router. ```json { "anthropic_api_base": "http://localhost:20128/v1", "anthropic_api_key": "your-9router-api-key" } ``` -------------------------------- ### Configure Codex CLI Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md Environment variables to set for Codex CLI to use 9Router. ```bash export OPENAI_BASE_URL="http://localhost:20128" export OPENAI_API_KEY="your-9router-api-key" codex "your prompt" ``` -------------------------------- ### Configure Cline / Continue / RooCode Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md Settings for Cline, Continue, or RooCode to use 9Router. ```text Provider: OpenAI Compatible Base URL: http://localhost:20128/v1 API Key: [from dashboard] Model: cc/claude-opus-4-5-20251101 ``` -------------------------------- ### Create Smart Combos Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md Steps to create a smart combo for automatic fallback between models in the dashboard. ```text Dashboard → Combos → Create New Name: premium-coding Models: 1. cc/claude-opus-4-5-20251101 (Subscription primary) 2. glm/glm-4.7 (Cheap backup, $0.6/1M) 3. if/kimi-k2-thinking (Free fallback) Use in CLI: premium-coding ``` -------------------------------- ### Kimi K2 Setup - Step 3: Add to 9Router Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/cheap.md Configuration to add the Kimi provider API key to 9Router. ```bash 9router # Dashboard → Providers → Add API Key Provider: kimi API Key: your-kimi-api-key ``` -------------------------------- ### Configure Cursor IDE Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md Settings for Cursor IDE to use 9Router as an OpenAI compatible endpoint. ```text Settings → Models → Advanced: OpenAI API Base URL: http://localhost:20128/v1 OpenAI API Key: [from 9router dashboard] Model: cc/claude-opus-4-5-20251101 ``` -------------------------------- ### Setup Source: https://github.com/decolua/9router/blob/master/tests/README.md Vitest must be installed globally or in /tmp/node_modules (due to npm workspace hoisting from the root Next.js project). ```bash cd /tmp && npm install vitest ``` -------------------------------- ### Create a Combo (Recommended) Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/cheap.md Example of creating a 'combo' in 9Router to chain multiple providers for fallback. ```bash Dashboard → Combos → Create New Name: cheap-backup Models: 1. cc/claude-opus-4-5 (prefer subscription) 2. glm/glm-4.7 (low-cost backup, daily reset) 3. minimax/MiniMax-M2.1 (cheapest fallback) 4. if/kimi-k2-thinking (free emergency) Use in CLI: cheap-backup ``` -------------------------------- ### 9router Docker Quick Start Source: https://github.com/decolua/9router/blob/master/README.md Run the 9router application using a pre-built Docker image. This command sets up a container with persistent data storage and exposes the default port. ```bash docker run -d \ --name 9router \ -p 20128:20128 \ -v "$HOME/.9router:/app/data" \ -e DATA_DIR=/app/data \ decolua/9router:latest ``` -------------------------------- ### Example 2: Budget Combo Configuration Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/features/combos.md Configuration details for the 'budget-combo'. ```text Dashboard → Combos → Create New Name: budget-combo Models: 1. glm/glm-4.7 2. minimax/MiniMax-M2.1 3. if/kimi-k2-thinking ``` -------------------------------- ### Example 3: Freelancer (Variable Usage) Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md Cost examples for a freelancer with variable monthly LLM usage, showing calculations for light and heavy months. ```text Light month (20M tokens): - 15M via subscription: $0 - 5M via GLM: $3 Total: $3 Heavy month (150M tokens): - 60M via subscription: $0 - 60M via GLM: $36 - 30M via MiniMax: $6 Total: $42 Average: $22.50/month vs $3400 on ChatGPT API! ``` -------------------------------- ### Minimize Costs Source: https://github.com/decolua/9router/blob/master/gitbook/content/es/features/combos.md Example combo starting with the cheapest paid option and falling back to even cheaper or free models. ```text glm/glm-4.7 → minimax/MiniMax-M2.1 → if/kimi-k2-thinking → Start with the cheapest paid option ($0.60/1M) → Fallback to an even cheaper one ($0.20/1M) → Free emergency tier → Total cost: ~$5-10/month vs $2000 on ChatGPT API ``` -------------------------------- ### Kimi K2 Setup: Add to 9Router Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md How to add the Kimi provider API key to 9Router. ```bash 9router # Dashboard → Providers → Add API Key Provider: kimi API Key: your-kimi-api-key ``` -------------------------------- ### Minimize Costs Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/features/combos.md A combo strategy to start with the cheapest paid models and fall back to free tiers. ```text glm/glm-4.7 → minimax/MiniMax-M2.1 → if/kimi-k2-thinking → Start with cheapest paid option ($0.60/1M) → Fallback to even cheaper ($0.20/1M) → Emergency free tier → Total cost: ~$5-10/month vs $2000 on ChatGPT API ``` -------------------------------- ### List Models API Request Source: https://github.com/decolua/9router/blob/master/README.md Example of how to make a GET request to the models endpoint to retrieve a list of available models. The response is in OpenAI format. ```bash GET http://localhost:20128/v1/models Authorization: Bearer your-api-key → Returns all models + combos in OpenAI format ``` -------------------------------- ### Best Practice 3: Combine with Free Tier Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md Setting up a model combo that prioritizes free tiers for cost minimization and uptime maximization. ```text Combo: 1. gc/gemini-3-flash (FREE primary) 2. glm/glm-4.7 (cheap backup) 3. minimax/MiniMax-M2.1 (cheapest) 4. if/kimi-k2-thinking (FREE emergency) Result: Minimize costs, maximize uptime ``` -------------------------------- ### Cost Optimization Strategy 2: Budget Prioritization Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/cheap.md An example of allocating a monthly budget across different providers to maximize token usage. ```bash Monthly Budget Setup: $20 Allocation: - $9 Kimi K2 (10M tokens fixed) - $6 GLM daily quota (10M tokens) - $5 MiniMax overflow (25M tokens) Total: 45M tokens for $20 vs 1M tokens for $20 with ChatGPT API! ``` -------------------------------- ### Create a Combo (Recommended) Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/free.md Example of creating a combo with multiple free providers for redundancy and quality. ```bash Dashboard → Combos → Create New Name: free-combo Models: 1. if/kimi-k2-thinking (iFlowプライマリ) 2. qw/qwen3-coder-plus (Qwenバックアップ) 3. kr/claude-sonnet-4.5 (Kiro品質) CLIで使用: free-combo ``` -------------------------------- ### Daily Quota Reset Strategy Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md A daily routine for managing different AI model quotas to ensure continuous usage with minimal cost. ```text Daily routine: 1. Morning: Fresh Claude Code quota (5h reset) 2. Afternoon: Switch to Gemini CLI (1K/day) 3. Evening: GLM daily quota (reset 10AM next day) 4. Late night: MiniMax (5h rolling) or iFlow (free) → Code 24/7 with minimal extra cost! ``` -------------------------------- ### Example 2: Budget Coder ($10/month) Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md A cost breakdown for a budget-conscious user spending $10 per month on LLM tokens. ```text Strategy: - $9 Kimi K2 (10M tokens) - $1 MiniMax overflow (5M tokens) Total: 15M tokens for $10 vs 0.5M tokens for $10 on ChatGPT API! 30× more tokens! ``` -------------------------------- ### MiniMax M2.1 Setup - Step 3: Add to 9Router Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/cheap.md Configuration to add the MiniMax provider API key to 9Router. ```bash 9router # Dashboard → Providers → Add API Key Provider: minimax API Key: your-minimax-api-key ``` -------------------------------- ### Connect Providers via API Key Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md Steps to connect providers like GLM, MiniMax, Kimi, and OpenRouter by adding an API key through the dashboard. ```text Dashboard → Providers → Add API Key → Select provider → Paste API key → Save ``` -------------------------------- ### MiniMax M2.1 Setup: Add to 9Router Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md How to add the MiniMax provider API key to 9Router. ```bash 9router # Dashboard → Providers → Add API Key Provider: minimax API Key: your-minimax-api-key ``` -------------------------------- ### Connect Providers via OAuth Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/quick-start.md Steps to connect subscription providers like Claude Code, Codex, Gemini CLI, and GitHub Copilot using OAuth through the dashboard. ```text Dashboard → Providers → Connect [Provider] → OAuth login → Auto token refresh → Quota tracking enabled ``` -------------------------------- ### Cursor IDE Setup Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md Configuration for Cursor IDE to use a local 9router instance for model access. ```text Settings Models Advanced: OpenAI API Base URL: http://localhost:20128/v1 OpenAI API Key: [from 9router dashboard] Model: glm/glm-4.7 ``` -------------------------------- ### Example 1: Heavy Coding Month (100M tokens) Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md A real-world example of cost breakdown for a heavy coding month using a mix of subscription and cheap providers. ```text Breakdown: - 60M via subscription (Claude/Codex): $0 extra - 30M via GLM-4.7: $18 - 10M via MiniMax M2.1: $2 Total: $20/month vs $2000 on ChatGPT API! Savings: 99% cheaper! ``` -------------------------------- ### Remove Global Installation Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/installation.md Command to uninstall the globally installed 9router package. ```bash npm uninstall -g 9router ``` -------------------------------- ### Environment Variables Setup Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/integration/other-tools.md Demonstrates how to store API keys and base URLs in a .env file for secure credential management. ```bash # .env file ROUTER_API_KEY=your-api-key-from-dashboard ROUTER_BASE_URL=http://localhost:20128/v1 ROUTER_MODEL=cc/claude-sonnet-4-20250514 ``` -------------------------------- ### Kimi K2 API Key Setup Source: https://github.com/decolua/9router/blob/master/gitbook/content/zh-CN/providers/cheap.md Steps to obtain and add the Kimi K2 API Key to 9Router. ```bash Dashboard → API Keys → Create New Key → Copy API key ``` ```bash 9router # Dashboard → Providers → Add API Key Provider: kimi API Key: your-kimi-api-key ``` -------------------------------- ### Create Combo (Recommended) Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/cheap.md Example of creating a model combo in the 9router dashboard for tiered fallback strategies. ```text Dashboard Combos Create New Name: cheap-backup Models: 1. cc/claude-opus-4-5 (Subscription primary) 2. glm/glm-4.7 (Cheap backup, daily reset) 3. minimax/MiniMax-M2.1 (Cheapest fallback) 4. if/kimi-k2-thinking (FREE emergency) Use in CLI: cheap-backup ``` -------------------------------- ### Cursor IDE Setup Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/providers/free.md Configuration for using free providers with Cursor IDE. ```yaml Settings → Models → Advanced: OpenAI API Base URL: http://localhost:20128/v1 OpenAI API Key: [from 9router dashboard] Model: if/kimi-k2-thinking ``` -------------------------------- ### Install Dependencies Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/deployment/cloud.md Installs the necessary Node.js dependencies for the application. ```bash npm install ``` -------------------------------- ### Verify key format Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/troubleshooting.md Example of correct and incorrect API key formats. ```text Correct: 9r_xxxxxxxxxxxxxxxxxxxxxxxx Wrong: Missing 9r_ prefix ``` -------------------------------- ### Tavily Example Source: https://github.com/decolua/9router/blob/master/skills/9router-web-fetch/SKILL.md Example of fetching content using Tavily. ```bash curl -X POST $NINEROUTER_URL/v1/web/fetch \ -H "Authorization: Bearer $NINEROUTER_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"tavily","url":"https://example.com","format":"markdown","max_characters":0}' ``` -------------------------------- ### Firecrawl Example Source: https://github.com/decolua/9router/blob/master/skills/9router-web-fetch/SKILL.md Example of fetching content using Firecrawl. ```bash curl -X POST $NINEROUTER_URL/v1/web/fetch \ -H "Authorization: Bearer $NINEROUTER_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"firecrawl","url":"https://example.com","format":"markdown","max_characters":0}' ``` -------------------------------- ### Exa Example Source: https://github.com/decolua/9router/blob/master/skills/9router-web-fetch/SKILL.md Example of fetching content using Exa. ```bash curl -X POST $NINEROUTER_URL/v1/web/fetch \ -H "Authorization: Bearer $NINEROUTER_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"exa","url":"https://example.com","format":"markdown","max_characters":0}' ``` -------------------------------- ### MiniMax M2.1 API Key Setup Source: https://github.com/decolua/9router/blob/master/gitbook/content/zh-CN/providers/cheap.md Steps to obtain and add the MiniMax M2.1 API Key to 9Router. ```bash Dashboard → API Management → Create Key → Copy API key ``` ```bash 9router # Dashboard → Providers → Add API Key Provider: minimax API Key: your-minimax-api-key ``` -------------------------------- ### Complex Reasoning Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/integration/roo.md Example of a complex reasoning query. ```text Ask Roo: "Analyze the trade-offs between microservices and monolithic architecture" Model: cx/deepseek-reasoner ``` -------------------------------- ### Code Generation Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/integration/roo.md Example of a code generation query. ```text Ask Roo: "Write a Python function to calculate Fibonacci numbers" Model: cx/deepseek-chat ``` -------------------------------- ### Basic Chat Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/integration/roo.md Example of a basic chat query. ```text Ask Roo: "Explain quantum computing in simple terms" Model: cc/claude-sonnet-4-20250514 ``` -------------------------------- ### Best Practice: Create Multiple Combos Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/features/combos.md Examples of combo names for different use cases. ```text premium-coding: For complex tasks budget-combo: For simple tasks free-combo: For experimentation quality-first: For production code ``` -------------------------------- ### Settings File Example Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/integration/claude-code.md Example of the Claude Code settings.json file. ```json { "baseUrl": "http://localhost:20128/v1", "defaultModel": "sonnet" } ``` -------------------------------- ### Restart Server (PM2) Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/getting-started/installation.md Commands to install PM2 and manage the 9router process for auto-restart. ```bash npm install -g pm2 pm2 start 9router --name 9router pm2 save ``` -------------------------------- ### Install PM2 Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/deployment/cloud.md Installs PM2, a process manager for Node.js applications, globally. ```bash npm install -g pm2 ``` -------------------------------- ### Cursor IDE Setup Source: https://github.com/decolua/9router/blob/master/gitbook/content/ja/providers/cheap.md Configuration for Cursor IDE to use 9Router providers. ```yaml Settings → Models → Advanced: OpenAI API Base URL: http://localhost:20128/v1 OpenAI API Key: [Get from 9router dashboard] Model: glm/glm-4.7 ``` -------------------------------- ### Install 9Router globally Source: https://github.com/decolua/9router/blob/master/gitbook/content/en/deployment/localhost.md Installs the 9Router application globally using npm. ```bash npm install -g 9router ```