Skip to content

Cursor: gahorouter Quick Start Guide

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

📋 Prerequisites

Before you begin, make sure you have:

  • Register a gahorouter account: Visit https://console.gahorouter.com/keys to register and subscribe (free trial available).
  • Install Cursor: Download the latest version from https://cursor.sh/, then install and open it to verify.
  • Install CC Switch: A configuration tool. Download the version for your system from https://github.com/farion1231/cc-switch (use .exe for Windows, .dmg for macOS), then install and run it.
  • Network: A stable network connection is required (in this guide, downloading Claude Code requires access to a VPN/proxy).

1. Create an API Key

1.1 Log in to the gahorouter Platform

Visit https://console.gahorouter.com/keys and enter your account and password.

1.2 Create a New API Key

Go to the API Keys page, click the "Create Key" button, and 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 for the key, and a blocklist to deny access.

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 Key (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 with PowerShell
irm https://claude.ai/install.ps1 | iex

macOS installation: Run in the terminal (Homebrew recommended; if Homebrew is not installed, first run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)")

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

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

Linux installation: Run in the terminal

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

Verify installation: Run claude --version; seeing "Claude CLI v1.x.x" indicates success.

bash
# Check whether the installation succeeded
claude --version

2.2 Configure Your gahorouter API Key

After installation, there are two 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 and go to the API Keys page.

  2. Click Export CCS.

  3. Click Allow to redirect, which 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://console.gahorouter.com", "User")

Priority notes:

  • Environment variables take priority over the 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 page, and confirm that you trust the workspace.

  2. 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 it:

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

Advantages:

  • ✅ No need to install additional plugins.
  • ✅ Simple configuration, all managed via ccswitch.
  • ✅ Supports full CLI functionality (parameters such as --files, --model).
  • ✅ Suitable for developers and command-line users.

Steps:

  1. Click [Open project] to open a project in Cursor.

  2. Open the Terminal.

  3. Type claude and press Enter to open the Claude Code CLI interactive page.

  4. Chat with Claude — "Please analyze the structure of this project". You can converse with or interact about the relevant contents under the directory.

Method 2: Using the Claude Code for VS Code Extension (For Users Who Prefer Not to Use the Command Line)

Provides a graphical interface for interaction through a Cursor extension.

Advantages:

  • ✅ Graphical interface with intuitive operation.
  • ✅ Sidebar chat, 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 Cursor extension marketplace and search for Claude Code for VS Code.

  2. Click Install to install the extension.

  3. After installation, an icon appears in the sidebar. Click the Spark icon to open the Claude Code panel.

  4. Use the chat box to converse with Claude.

(If the 💥 shortcut icon is missing, 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 simultaneously and share the ccswitch configuration. The extension automatically reads ccswitch's current configuration.

4. Hands-On Practice with Cursor

This chapter demonstrates real-world scenarios for using Claude Code in Cursor, 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 Cursor terminal (Ctrl+`)
cd ~/projects/legacy-api

# Start a conversation
claude chat

Example conversation:

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"

Example conversation:

plaintext
👤 You: How is the code quality of this file? What improvements would you suggest?

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

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

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

❌ Issues:
1. No retry mechanism (failed sends cannot be retried)
2. No email queue (concurrent sending blocks)
3. Hardcoded email templates (hard to maintain)
4. No 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 improvements):
- 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 refactor it for you? I can generate the improved code.

Scenario 3: Requirements 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: do you need cropping/compression?

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

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

Please answer these questions and I'll provide a complete solution.

Summary of Conversation Techniques

Make the context clear

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 problems"

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 code" → automatically activates Code Review
  • Say "write tests" → automatically activates Test Generation
  • Say "there's an error" → automatically activates Debug Assistant

5. Monitor Usage

5.1 View Token Consumption

View it in gahorouter:

  1. System Overview: Go to the dashboard.

  2. Cumulative API Usage: Go to the API Keys page.

  3. 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: