Model Router Setup

Easily set up Model Router to optimize AI model usage based on your environment and preferences.

First-time setup wizard for Model Router. Detects your environment, configures subscriptions, and sets up routing preferences.

Trigger

User runs /model-router:setup or this is the first time using any model-router command.

Instructions

You are setting up Model Router for the user. Follow this flow:

1. Welcome and Detect Environment

First, welcome the user and run environment detection:

Welcome to Model Router! Let's get you set up.

This tool helps you route tasks to the best AI model based on:
- What you're trying to do (code review, reasoning, simple edits)
- What subscriptions and tools you have available
- Your preferences (quality vs cost)

Let me check what you have installed...

Run the detection script:

python3 "$(dirname "$0")/../../scripts/detect_environment.py" --json

Parse the results and summarize what was found.

2. Subscriptions Question

Ask about subscriptions using AskUserQuestion with multiSelect:

Which AI subscriptions do you have?

□ Claude Pro ($20/mo) - You're using Claude Code, so likely yes
□ ChatGPT Plus ($20/mo) - Includes Codex CLI for GPT-5.2
□ Google AI Pro ($20/mo) - Includes Gemini CLI
□ None / API-only usage

3. CLI Tools Setup

For each subscription they have, check if the CLI is set up:

If they have ChatGPT Plus but Codex CLI not detected:

You have ChatGPT Plus but Codex CLI isn't set up yet.

Codex CLI lets you use GPT-5.2 from the terminal - included with your subscription.

Would you like to set it up now?
○ Yes, walk me through it
○ No, skip for now

If yes, guide them:

Let's set up Codex CLI:

1. Install: npm install -g @openai/codex
2. Authenticate: codex auth
3. This will open your browser for OAuth login

[Run the install command for them]
[Test the connection: codex exec -m gpt-5.2 "say test"]

Same flow for Gemini CLI if they have Google AI Pro.

4. Local Models (Ollama)

Based on detection results:

If Ollama detected with models:

I detected Ollama running with these models:
- llama3.3:70b
- deepseek-r1:70b

These are free local models - great for saving on API costs!

Would you like to include them in routing?
○ Yes, use local models when appropriate [RECOMMENDED]
○ No, only use cloud models

If Ollama detected but no large models:

You have Ollama but only small models (7B).

For better quality, you could pull larger models:
- deepseek-r1:70b (best for reasoning, needs ~42GB RAM)
- llama3.3:70b (great all-rounder, needs ~42GB RAM)

Your system has [X]GB RAM.

Would you like to:
○ Pull deepseek-r1:70b now (recommended for your RAM)
○ Pull llama3.3:70b now
○ Skip for now

If no Ollama and system has 32GB+ RAM:

Your system has [X]GB RAM - enough to run local AI models for free!

Ollama lets you run models like Llama 3.3 70B locally.

Would you like to:
○ Set up Ollama now (recommended)
○ Skip local models

If no Ollama and insufficient RAM:

Local models require 16GB+ RAM. Your system has [X]GB.

Do you have another machine that could run Ollama?
○ Yes, enter the host address
○ No, skip local models

5. Routing Preference

When routing tasks, which services should we try FIRST?
(To preserve your Claude usage for complex tasks)

○ ChatGPT + Gemini first (preserve Claude) [RECOMMENDED]
  Use GPT-5.2 and Gemini for routine work, save Claude for complex tasks

○ Claude first (best quality)
  Always use Claude when available, uses subscription faster

○ Cheapest first (maximize free/local)
  Use Ollama and Gemini Flash whenever possible

○ Ask me each time
  Show recommendation and let me choose

6. Profile Selection

Choose your default routing profile:

○ Quality - Always use the best model for the task
○ Balanced - Smart routing based on task complexity [DEFAULT]
○ Budget - Maximize cheap/free models
○ Local-only - Only use Ollama, never cloud

7. Tracking Preferences

Would you like to enable usage tracking?
This helps Model Router learn which models work best for you.

○ No tracking [DEFAULT]
○ Yes, basic - Task type, model used, success/fail
○ Yes, detailed - Include quality ratings and timing

8. Write Configuration

Create the config directory and file:

mkdir -p ~/.model-router

Write ~/.model-router/config.yaml:

version: "1.0"
created_at: [timestamp]

subscriptions:
  claude_pro: true/false
  chatgpt_plus: true/false
  google_ai_pro: true/false

cli_tools:
  codex:
    installed: true/false
    path: /path/to/codex
  gemini:
    installed: true/false
    path: /path/to/gemini

ollama:
  enabled: true/false
  host: localhost
  port: 11434
  models:
    - llama3.3:70b
    - deepseek-r1:70b

preferences:
  routing: preserve_claude | quality_first | budget_first | ask_each_time
  profile: quality | balanced | budget | local_only

tracking:
  enabled: true/false
  level: none | basic | detailed

Copy the default models.yaml to user's config:

cp "$(dirname "$0")/../../data/models.yaml" ~/.model-router/models.yaml

9. Summary

Show a summary of the setup:

Setup complete! Here's your configuration:

┌─ Model Router Configuration ─────────────────────────────┐
│                                                          │
│ Subscriptions:                                           │
│   ✓ Claude Pro    ✓ ChatGPT Plus    ✓ Google AI Pro     │
│                                                          │
│ CLI Tools:                                               │
│   ✓ Codex CLI (GPT-5.2)                                 │
│   ✓ Gemini CLI                                          │
│                                                          │
│ Local Models (Ollama):                                   │
│   ✓ llama3.3:70b                                        │
│   ✓ deepseek-r1:70b                                     │
│                                                          │
│ Routing: ChatGPT + Gemini first (preserve Claude)       │
│ Profile: Balanced                                        │
│ Tracking: Disabled                                       │
│                                                          │
├──────────────────────────────────────────────────────────┤
│                                                          │
│ Quick commands:                                          │
│   /model-router:help      - See all commands            │
│   /model-router:recommend - Get model recommendation    │
│   /model-router:status    - Check current config        │
│   /model-router:configure - Change settings             │
│                                                          │
└──────────────────────────────────────────────────────────┘

You're all set! Model Router will now help you choose the best
model for each task based on your setup.

Files Referenced

  • scripts/detect_environment.py - Environment detection
  • data/models.yaml - Default model recommendations
  • ~/.model-router/config.yaml - User configuration (created)
  • ~/.model-router/models.yaml - User's model recommendations (copied)