Skip to content

VSCode: gahorouter Quick Start Guide

Go from creating an API Key to using Claude Code for AI-assisted development in 5 minutes

Prerequisites

Before you begin, make sure the following are in place (if anything is missing, follow along):

  • Register a gahorouter account: Visit https://console.gahorouter.com/keys , register, and subscribe (a free trial is available).
  • Install VSCode: Download the latest version (≥1.80) from https://code.visualstudio.com/ , then install and open it to verify.
  • Install CC Switch: This is the configuration tool. Download the version for your system from https://github.com/farion1231/cc-switch (use .exe on Windows, .dmg on macOS), install it, open it, and make sure it is running. See section 2.2 for details.
  • Network: A stable network connection is required (in this guide, downloading Claude Code requires the ability to access the internet via a proxy/VPN).

1. Create an API Key

1.1 Log in to the gahorouter Platform

Visit https://console.gahorouter.com/keys and log in with your account credentials.

1.2 Create a New API Key

  1. Go to the API Keys page
  2. Click the "Create Key" button
  3. Fill in the configuration:
FieldDescription
NameRequired. The API Key name (for easy identification).
GroupRequired. Choose an appropriate group based on your plan's subscription permissions.
Custom KeyOptional. Use a custom string as the API key.
IP RestrictionOptional. Set an IP allowlist of addresses permitted to use the key, and a blocklist of IPs denied access.
  1. Click "Create" to generate the API Key

1.3 View API Key Information

Go to the API Keys page, view the API key, copy the newly generated API Key (format: sk-xxxxxx), and save it to a notepad.

2. Install and Configure Claude Code

2.1 Install the Claude CLI

Windows installation: Run in PowerShell

powershell
# Install using PowerShell
irm https://claude.ai/install.ps1 | iex

macOS installation: Run in the terminal (Homebrew recommended; if you don't have it, install Homebrew first: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"):

bash
# Install using Homebrew (recommended)
brew install --cask claude-code

# Or install using curl
curl -fsSL https://claude.ai/install.sh | sh

Linux installation: Run in the terminal

bash
# Install using curl
curl -fsSL https://claude.ai/install.sh | sh

Verify the installation: Run claude --version in the terminal. Seeing "Claude CLI v1.x.x" means it succeeded.

bash
# Check whether the installation succeeded
claude --version

2.2 Configure the gahorouter API Key

After installation, there are 2 ways to configure the Claude Code API:

ccswitch is an open-source configuration management tool that lets you quickly switch between and manage multiple API configurations.

If it is not installed, download it from the official site https://github.com/farion1231/cc-switch (install the version matching your operating system).

Steps:

  1. Log in to gahorouter, go to the API Keys page, and click Export CCS

  1. Click Allow to be redirected; this opens the CC Switch app and automatically imports the configuration from step one

💡 Tip: ccswitch saves the configuration to ~/.gahorouter/config.json and supports switching between multiple environments (development/testing/production).

macOS/Linux: Edit ~/.zshrc or ~/.bashrc

bash
# gahorouter API configuration
export ANTHROPIC_API_KEY="sk-gahorouter-xxxxxxxxxxxxxxxxxxxx"
export ANTHROPIC_BASE_URL="https://console.gahorouter.com"

Then run:

bash
source ~/.zshrc # or source ~/.bashrc

Windows PowerShell:

powershell
# Temporary setting (current session)
$env:ANTHROPIC_API_KEY = "sk-gahorouter-xxxxxxxxxxxxxxxxxxxx"
$env:ANTHROPIC_BASE_URL = "https://console.gahorouter.com"

# Permanent setting (system environment variables)
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "sk-gahorouter-xxx", "User")
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.gahorouter.com/v1", "User")

Priority note:

  • Environment variables take priority over ccswitch configuration
  • If both are set, environment variables override the ccswitch configuration

2.3 Verify the Configuration

Run a test in the terminal:

  1. Type claude in the terminal to open the Claude Code interactive screen, and confirm that you trust the workspace

  1. Type "Hello" and wait for Claude to reply

Expected result:

  • ✅ Claude returns a friendly reply message
  • ❌ If you get an "Authentication failed" error: check whether the API Key is correct
  • ❌ If you get a "Cannot connect to API" error: check whether the BASE_URL is correct or check your network connection

3. Start Using Claude Code

3.1 Usage Methods

gahorouter supports two ways to use Claude Code:

Use Claude CLI commands directly in VSCode's integrated terminal.

Advantages:

  • ✅ No extra plugins required
  • ✅ Simple configuration, managed uniformly with ccswitch
  • ✅ Supports the full set of CLI features (parameters such as --files, --model, etc.)
  • ✅ Suitable for developers and command-line users

Steps:

  1. Open a project directory in VSCode

  1. Open the Terminal

  1. Type "claude" and press Enter to open the Claude Code CLI interactive screen

  1. Choose to trust the workspace

  1. You have successfully entered the conversation interface

  1. Chat with Claude — "Please analyze the structure of this project" — you can converse with or interact about the relevant content under the directory

Method 2: Use the Claude Code for VS Code Plugin (for users who prefer not to use the command line)

Provides a graphical interface for interaction via a VSCode extension.

Advantages:

  • ✅ Graphical interface, intuitive to operate
  • ✅ Sidebar conversation, no need to switch to the terminal
  • ✅ Supports code highlighting and syntax coloring
  • ✅ Suitable for users unfamiliar with the command line

Installation steps:

  1. Open the VSCode Extension Marketplace, search for Claude Code for VS Code, and click Install to install the plugin

  1. After installation, an icon appears in the sidebar; click the Spark icon to open the Claude Code panel
  2. Ask a question in the dialog box to chat with Claude

(If you don't see the 💥 shortcut icon, it has been collapsed into the "More" menu. Right-click 【···】 and check claude code:open to reveal the shortcut for the hidden feature.)

💡 Tip: Both methods can be used at the same time and share the ccswitch configuration. The plugin automatically reads ccswitch's current configuration.

4. VSCode Hands-On Practice

This chapter demonstrates real-world scenarios for using Claude Code in VSCode, including conversation techniques and the use of official Skills.

Example Use Cases

Scenario 1: Understanding an Unfamiliar Project

Suppose you have just taken over a project and need to understand it quickly.

bash
# In the VSCode terminal (Ctrl+`)
cd ~/projects/legacy-api

# Start a conversation
claude chat

Conversation example:

plaintext
👤 You: Please help me understand the overall architecture of this project

🤖 Claude: Let me analyze this project...

[Claude automatically reads the project structure]

Here is the answer

---

👤 You: How is the authentication flow implemented?

🤖 Claude: Let me look at the authentication-related code...

[Analyzing src/xxx.js and src/xxx.js]

Here is the answer

Scenario 2: Code Refactoring Consultation

bash
claude chat --files "src/utils/emailSender.js"

Conversation example:

plaintext
👤 You: How is the code quality of this file? Any suggestions for improvement?

🤖 Claude: Let me analyze emailSender.js...

Code quality assessment: ⭐⭐⭐ (3/5)

✅ What's done well:
1. Uses the mature nodemailer library
2. Configuration is managed via environment variables
3. Has basic error handling

❌ Existing problems:
1. Lacks a retry mechanism (failed sends cannot be retried)
2. No email queue (concurrent sending will block)
3. Hard-coded email templates (hard to maintain)
4. Lacks logging
5. Test coverage is 0

🔧 Refactoring suggestions:

Priority P0 (must fix):
- Add a retry mechanism (use the retry library)
- Add error logging

Priority P1 (recommended optimizations):
- Introduce an email queue (Bull + Redis)
- Templatize email content (use handlebars)

Priority P2 (long-term improvements):
- Add unit tests
- Performance monitoring (send latency, success rate)

Would you like me to help you refactor? I can generate the improved code.

Scenario 3: Requirement Clarification

plaintext
👤 You: I need to implement a user avatar upload feature. Help me clarify my thinking.

🤖 Claude: [Automatically activates the Clarification Engine Skill]

Let me help you clarify the requirements...

Core questions:
1. Storage method?
- Local file system
- Cloud storage (AWS S3 / Alibaba Cloud OSS)
- Database (not recommended)

2. File restrictions?
- Size limit: 2MB recommended
- Format restrictions: jpg, png, webp
- Dimension requirements: is cropping/compression needed

3. Security considerations?
- File type validation (to prevent uploading malicious files)
- Filename handling (to prevent path traversal)
- Access control (public or private)

4. Performance optimization?
- Image compression
- CDN acceleration
- Thumbnail generation

Please answer these questions and I will provide a complete plan.

Conversation Tips Summary

Be clear about context

bash
# ✅ A good question
claude chat --files "src/auth/**/*.js" "Analyze the security of the authentication module"

# ❌ A poor question
claude chat "The code has a problem"

Execute step by step

plaintext
Conversation 1: Understand the requirements
Conversation 2: Design the solution
Conversation 3: Generate the code
Conversation 4: Review the code

Leverage automatic Skill activation

  • Say "review the code" → automatically activates Code Review
  • Say "write tests" → automatically activates Test Generation
  • Say "got an error" → automatically activates Debug Assistant

5. Monitor Usage

5.1 View Token Consumption

Check in gahorouter:

System Overview: Go to the dashboard

Cumulative API Usage: Go to the API Keys page

Real-Time Logs: Go to the usage records page

5.2 Edit Personal Information

Go to the Profile page

Getting Help

If you run into problems: