Trae Integration
Use the Claude Code extension in ByteDance's Trae IDE (including offline install guide for Trae CN)
Trae Integration¶
Trae is an AI-native IDE from ByteDance, built as a fork of VS Code. It is compatible with most VS Code extensions while shipping its own Builder and Chat AI agents. This guide explains how to install and use the Claude Code extension in Trae (international edition) or Trae CN (China edition), accessing Claude, Codex and other models through QCode.cc.
Prerequisites¶
Before configuring the Trae extension, ensure:
-
Claude Code CLI is installed and working
-
See Installation Guide to complete installation
-
See Environment Configuration to complete setup
-
Trae or Trae CN is installed and up to date
-
International edition: trae.ai
- China edition (Trae CN): trae.com.cn
When to use Trae CN? Trae CN is optimized for mainland China network conditions; if you are based outside mainland China or already have reliable international connectivity, the international edition is recommended.
Installation Steps¶
Step 1: Install the Claude Code Extension¶
Trae is compatible with most VS Code extensions. The Claude Code extension can be installed via two paths — try them in order.
Path A: Install from Trae's Built-in Extension Marketplace (Recommended)¶
-
Open Trae and navigate to the Extensions panel (
Ctrl+Shift+X/Cmd+Shift+X) -
Search for "Claude Code" (publisher: Anthropic)
-
Click Install
If the extension is not found in the Trae marketplace (common on earlier Trae CN builds), use Path B.
Path B: Offline .vsix Local Install¶
This is the most reliable path for Trae CN users:
-
Open the Claude Code extension page
-
Find the Download Extension link in the right sidebar and download the
.vsixfile
Tip: Accessing the VS Code Marketplace from mainland China may require a proxy. If the download fails locally, download the
.vsixon a machine with a reliable international connection and copy it over.
- In Trae, open the Extensions panel → click the ⋯ menu in the upper right → Install from VSIX, and select the downloaded
.vsixfile
Or use the command line:
bash
trae --install-extension /path/to/claude-code-x.x.x.vsix
Step 2: Configure primaryApiKey¶
This is a critical step! The Claude Code extension requires primaryApiKey in the configuration file.
Good news: Trae shares the same configuration path as VS Code (
~/.claude/config.json). Users who already configured VS Code do not need to repeat this step.
Windows¶
Edit or create the config file C:\Users\YourUsername\.claude\config.json:
{
"primaryApiKey": "qcode"
}
macOS¶
Edit or create the config file ~/.claude/config.json:
mkdir -p ~/.claude
cat > ~/.claude/config.json << 'EOF'
{
"primaryApiKey": "qcode"
}
EOF
Linux¶
Edit or create the config file ~/.claude/config.json:
mkdir -p ~/.claude
cat > ~/.claude/config.json << 'EOF'
{
"primaryApiKey": "qcode"
}
EOF
Note: The value of
primaryApiKeycan be anything (likeqcode); what matters is that the field is set. The actual API authentication still uses theANTHROPIC_AUTH_TOKENfrom your environment variables.Important: The config file is
config.json, NOTsettings.json. Please distinguish carefully between the two.
Step 3: Restart Trae¶
After configuration, restart Trae for the changes to take effect.
Relationship with Trae's Built-in AI¶
Trae ships with its own Builder and Chat AI modes, powered by ByteDance's backend. The official Anthropic Claude Code extension talks to the ANTHROPIC_BASE_URL you configured (i.e. the QCode.cc proxy). The two are fully independent and can coexist:
| Capability | Trae Built-in AI | Claude Code Extension (QCode.cc) |
|---|---|---|
| Backend | ByteDance | Anthropic official / QCode.cc proxy |
| Models | Trae's curated selection | Claude 4.x / Codex / Opus 4.7 etc. |
| Billing | Trae's own billing | QCode.cc plan usage |
| Shortcut | Trae's custom keys | Cmd+Esc / Ctrl+Esc |
If you already purchased a QCode.cc subscription, we recommend using the Claude Code extension as your primary driver to get the most value out of your plan.
Usage¶
Keyboard Shortcuts¶
| Shortcut | Function |
|---|---|
Cmd+Esc / Ctrl+Esc |
Open/Close Claude Code panel |
Cmd+Shift+P / Ctrl+Shift+P |
Open command palette, search for Claude commands |
Common Features¶
-
Code Explanation
-
Select code
- Right-click and choose "Ask Claude" or use shortcut
-
Enter your question, e.g., "Explain this code"
-
Code Generation
-
Open Claude panel
- Describe the feature you need
-
Claude will generate code with insert options
-
Code Refactoring
-
Select code to refactor
- Ask Claude to help refactor
-
Preview and apply changes
-
Error Fixing
-
When code has errors
- Select the error code or message
- Ask Claude to analyze and provide fixes
Configuration Options¶
In Trae settings you can adjust Claude Code extension behavior (these settings are identical to VS Code):
-
Open Settings (
Ctrl+,/Cmd+,) -
Search for "Claude Code"
-
Adjust options as needed
Common Settings¶
{
"claude-code.autoSuggest": true,
"claude-code.inlineChat": true
}
Using with Terminal CLI¶
The Trae extension and terminal CLI can be used together:
| Scenario | Recommended Tool |
|---|---|
| Quick code edits | Trae extension |
| Complex project analysis | Terminal CLI |
| Code review | Either |
| Git operations | Terminal CLI |
| File generation | Either |
Troubleshooting¶
Claude Code Not Found in the Marketplace¶
Symptoms: Searching for "Claude Code" in Trae's Extensions panel returns no results, or the results are not the official Anthropic-published extension.
Solution: Use Path B: Offline .vsix Local Install (see Step 1 above). This is currently the most reliable path for Trae CN users.
Trae CN Cannot Download the .vsix¶
Symptoms: Accessing marketplace.visualstudio.com fails or downloads at 0 B/s.
Solution:
-
Download the
.vsixover a reliable international connection or through a proxy -
Or contact QCode.cc support for a mirror link of the Claude Code extension
.vsix -
Install via "Install from VSIX" once the file is available locally
Claude Code Panel Blank or Won't Start¶
-
Confirm
~/.claude/config.jsonexists and contains valid JSON -
Confirm the filename is
config.json, NOTsettings.json(the most common pitfall) -
Confirm environment variables
ANTHROPIC_BASE_URLandANTHROPIC_AUTH_TOKENare set -
Run
claudein the terminal to verify the CLI works
Shortcut Conflicts with Trae's Built-in AI¶
If Cmd+Esc / Ctrl+Esc is captured by Trae's Builder or Chat:
-
Open Trae Settings → Keyboard Shortcuts
-
Search for
claude-codeorClaude Code -
Rebind "Claude Code: Toggle Panel" to a non-conflicting key
Connection Timeout¶
-
Check that
https://asia.qcode.ccis reachable from your network -
Verify the
ANTHROPIC_BASE_URLenvironment variable -
Users in mainland China can use
asia.qcode.ccorcn.qcode.ccentry points without a proxy
Next Steps¶
-
Explore CLI Tips to boost efficiency
-
Learn Workflow Tips to optimize your development flow
-
See VS Code Integration if you also use VS Code