Trae: gahorouter Quick Start Guide
⏱️ Done in 5 minutes: from creating an API Key to using Claude Code for AI-assisted development in Trae
Two Installation Paths — Choose Whichever Suits You
| Item | Path A: CLI + Plugin | Path B: Plugin Only (No CLI) |
|---|---|---|
| Who it's for | Developers who like the command line | Those who don't want to install a CLI and only use the GUI |
| Installation steps | One extra step (install the CLI) | One fewer step |
| Feature differences | Both CLI and sidebar available | Sidebar only |
| Configuration method | CC Switch or environment variables | CC Switch or environment variables (same) |
Prerequisites
Before you start, make sure you have:
- Register a gahorouter account: Visit https://console.gahorouter.com/keys to register and subscribe (a free trial is available)
- Install Trae: Download the latest version from https://www.trae.ai/ (users in China can visit https://www.trae.com.cn/), then install and open it to test
- Network: A stable network connection is required (Path A requires the ability to access international networks when downloading the Claude Code CLI; Path B has no such requirement)
Step 1: Create an API Key (Same for Both Paths)
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
- Fill in the configuration details:
| Configuration | Description |
|---|---|
| Name | Required. The API Key name (for easy identification) |
| Group | Required. Choose an appropriate group based on your plan's subscription permissions |
| Custom Key | Optional. Use a custom string as the API key |
| IP Restriction | Optional. Set an allow/deny IP whitelist or blacklist |
- Click "Create" to generate the API Key
1.3 Save the API Key
Go to the API Keys page, copy the Key (sk-xxxxxx), and save it to a notepad for later use.
Path A: CLI + Plugin
Step 2A: Install the Claude CLI
Windows (run in PowerShell):
irm https://claude.ai/install.ps1 | iexmacOS (Homebrew recommended; if Homebrew is not installed, run the command below first):
# Install Homebrew (skip if already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Claude Code
brew install --cask claude-codeLinux:
curl -fsSL https://claude.ai/install.sh | shVerify the installation:
claude --version
# Showing "Claude CLI v1.x.x" means successStep 3A: Configure the API (Pick One)
Choose the method that fits your habits — both produce exactly the same result.
✅ Option A: Use CC Switch (Recommended for Beginners)
CC Switch is a visual configuration tool provided by gahorouter. It supports one-click import and multi-environment switching, with no need to manually edit configuration files.
3A.1 Install CC Switch
Go to https://github.com/farion1231/cc-switch and download the version for your system:
- Windows: Download the .exe installer, then install and run it
- macOS: Download the .dmg installer, then install and run it
3A.2 One-Click Import Configuration
- Log in to gahorouter and go to the API Keys page
- Find the target Key and click the "Export CCS" button
- When the redirect prompt appears, click "Allow"
- The system automatically opens the CC Switch app and completes the configuration import
💡 CC Switch saves the configuration to ~/.gahorouter/config.json and supports multi-environment switching (development / testing / production)
3A.3 Verify the Configuration
Open a terminal and enter:
claudeAfter entering the Claude Code interactive page, type "Hello" and wait for a reply.
- ✅ Claude returns a normal reply → Configuration successful
- ❌ Authentication failed → Check whether the API Key was imported correctly
- ❌ Cannot connect to API → Check your network connection
✅ Option B: Manually Set Environment Variables (Recommended for Developers)
Configuring manually via environment variables suits developers familiar with the command line and makes reuse easy in CI/CD, Docker, scripts, and similar scenarios.
macOS / Linux:
Edit ~/.zshrc (zsh) or ~/.bashrc (bash) and add the following at the end:
# gahorouter API configuration
export ANTHROPIC_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxx"
export ANTHROPIC_BASE_URL="https://console.gahorouter.com"After saving, run:
source ~/.zshrc # for zsh users
# or
source ~/.bashrc # for bash usersWindows PowerShell:
# Permanent setting (writes to the system user environment variables; takes effect after restarting the terminal)
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "sk-xxxxxxxxxxxxxxxxxxxxxx", "User")
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://console.gahorouter.com", "User")Verify the environment variables:
echo $ANTHROPIC_API_KEY # macOS/Linux
echo $env:ANTHROPIC_API_KEY # Windows PowerShellOutputting your Key value means success.
Verify the connection:
claudeAfter entering the interactive page, type "Hello" and wait for a reply.
- ✅ Claude returns a normal reply → Configuration successful
- ❌ Authentication failed → Check that the Key value was pasted completely, with no leading or trailing spaces
- ❌ Cannot connect to API → Check that ANTHROPIC_BASE_URL is correct, or check your network connection
⚠️ Priority note: Environment variables take precedence over CC Switch configuration. If both are set, the environment variables override the CC Switch values.
Path B: Plugin Only (No CLI Installation Required)
Suitable for users who don't want to use the command line. Skip the CLI installation and install the plugin directly in Trae to use the graphical interface.
Step 2B: Install the Claude Code Plugin in Trae
- Open Trae and click the Extensions icon in the left activity bar, or press Ctrl+Shift+X
- Type "Claude Code" in the search box
- Find Claude Code for VS Code and click "Install"
- After installation, the ⚡ Spark icon appears in the left activity bar
💡 If the icon doesn't appear in the sidebar, it may be collapsed. Right-click the empty area of the activity bar or open the ··· More menu, then check "claude code: open" to display the icon.
Step 3B: Configure the API (Pick One)
The plugin obtains the API Key by reading system environment variables or the CC Switch configuration. The configuration method is exactly the same as Path A — just pick one.
✅ Option A: Use CC Switch (Recommended for Beginners)
Follow the steps in "Option A: Use CC Switch" under Path A — they are exactly the same.
After configuration, there is no need to open a terminal. Go directly to Step 4B to verify.
✅ Option B: Manually Set Environment Variables (Recommended for Developers)
macOS / Linux:
Edit ~/.zshrc (zsh) or ~/.bashrc (bash) and add the following at the end:
export ANTHROPIC_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxx"
export ANTHROPIC_BASE_URL="https://console.gahorouter.com"After saving, run:
source ~/.zshrc # for zsh users
# or
source ~/.bashrc # for bash usersWindows PowerShell:
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "sk-xxxxxxxxxxxxxxxxxxxxxx", "User")
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://console.gahorouter.com", "User")⚠️ On Windows, after setting the system environment variables, you must completely close Trae and reopen it before the plugin can read the new variables.
Step 4B: Verify the Plugin Connection
- In Trae, click the ⚡ Spark icon on the left to open the Claude Code panel
- Type "Hello" in the dialog box
- Claude returns a normal reply → Configuration successful
Common errors:
- ❌ Authentication failed → Check that ANTHROPIC_API_KEY is correct, then restart Trae and try again
- ❌ Cannot connect → Check that ANTHROPIC_BASE_URL is https://console.gahorouter.com — note that it does not include /v1
Step 4: Using It in Trae (Same for Both Paths)
Mode 1: Trae Terminal Integration (Path A Only)
Run the Claude CLI directly in Trae's built-in terminal, with no extra plugin needed.
Advantages:
- ✅ Supports full CLI parameters (--files, --model, etc.)
- ✅ Suited to developers and command-line users
Steps:
- Open a project in Trae (menu bar File → Open Folder, or click Open Project on the start page)
- Open a terminal (menu bar Terminal → New Terminal, or shortcut Ctrl+`; on macOS, Control+`)
- Type claude in the terminal and press Enter to enter the Claude Code interactive page
- On first use, confirm trusting the current workspace by following the prompts
- Start chatting, for example: "Please analyze the structure of this project"
Mode 2: Claude Code for VS Code Plugin (Available in Both Path A and Path B)
Trae is built on the VS Code core and is fully compatible with VS Code extensions. You can install the Claude Code plugin directly to get a graphical sidebar interface.
Advantages:
- ✅ Graphical interface, intuitive to use
- ✅ Sidebar chat, no need to switch to a terminal
- ✅ Supports code highlighting and syntax coloring
- ✅ Suited to users unfamiliar with the command line
Steps:
- Open the Trae extension marketplace (click the Extensions icon in the left activity bar, or use the shortcut Ctrl+Shift+X)
- Type "Claude Code" in the search box
- Find Claude Code for VS Code and click "Install" (Path B users have already done this in Step 2B)
- After installation, the ⚡ Spark icon appears in the left activity bar; click it to open the Claude Code panel
- Interact with Claude in the dialog box
💡 If the icon doesn't appear in the sidebar, it may be collapsed. Right-click the empty area of the activity bar or open the ··· More menu, then check "claude code: open" to display the icon.
💡 Path A users can use both modes at the same time, sharing the same API configuration.
Step 5: Hands-On Conversation Examples
Scenario 1: Understanding an Unfamiliar Project
👤 You: Please help me understand the overall architecture of this project
🤖 Claude: Let me analyze this project...
[Automatically reads the project directory structure]
This is a REST API project based on Express + MongoDB...Scenario 2: Code Refactoring Consultation
# Launch with a file (terminal mode, Path A)
claude chat --files "src/utils/emailSender.js"👤 You: How is the code quality of this file? Any suggestions for improvement?
🤖 Claude: Code quality assessment: ⭐⭐⭐ (3/5)
✅ What's done well: ...
❌ Existing issues: ...
🔧 Refactoring suggestions (by priority): ...Scenario 3: Bug Debugging
👤 You: I got an error when running: TypeError: Cannot read properties of undefined
🤖 Claude: Let me analyze this error...
[Locates line 42 in src/api/user.js]
Root cause: the user object's property was accessed before it was initialized...
Fix: ...Conversation Tips
| Tip | Example |
|---|---|
| Provide file context | --files "src/auth/**/*.js" |
| Break tasks into steps | Understand first → then design → then generate code |
| Trigger built-in Skills | Say "review the code" / "write tests" / "got an error" |
Getting Help
If you run into problems:
- Technical support email: support@gahorouter.com
- gahorouter official QQ: 3968077268
Related Links
- gahorouter Console: https://console.gahorouter.com
- Product website: https://gahorouter.com
- CC Switch download: https://github.com/farion1231/cc-switch