TronCode API Usage Guide
Use Claude Code and other AI tools via the TronCode API endpoint — no direct access to Anthropic services required. Just set two environment variables, ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, to get started.
TronCode API endpoint: https://openapi.troncode.cn
Before getting started, register and obtain an API Key at the TronCode Platform.
Before getting started, register and obtain an API Key at the TronCode Platform.
Windows Installation
Method 1: One-Click Install (Recommended)
Run the following command in PowerShell to automatically install Node.js and Claude Code:
curl -fsSL https://claude.ai/install.sh | bash
This command requires access to the international internet. Make sure your network can reach claude.ai. If not, you may need a VPN or proxy.
Method 2: Manual Install
1
Install Node.js
Visit the Node.js download page, download the LTS version, and run the .msi installer.
2
Install Claude Code
Open PowerShell and run:
npm install -g @anthropic-ai/claude-code
If you get an "execution policy" error, open PowerShell as Administrator and run:
Set-ExecutionPolicy RemoteSigned, then type Y to confirm and retry the install.3
Configure Environment Variables
Run in PowerShell (persistent — survives restarts):
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://openapi.troncode.cn", "User")
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "your-api-key", "User")
Or temporary (current session only):
$env:ANTHROPIC_BASE_URL = "https://openapi.troncode.cn"
$env:ANTHROPIC_AUTH_TOKEN = "your-api-key"
4
Verify Installation
claude --version
If a version number is displayed, installation was successful!
5
Getting Started
# Navigate to your project directory
cd C:\path\to\your\project
# Launch Claude Code
claude
macOS Installation
Method 1: One-Click Install (Recommended)
Open Terminal and run:
curl -fsSL https://claude.ai/install.sh | bash
This command requires access to the international internet. Make sure your network can reach claude.ai.
Method 2: Manual Install
1
Install Node.js
Recommended: use Homebrew:
brew install node
Or download the .pkg installer from the official website.
2
Install Claude Code
npm install -g @anthropic-ai/claude-code
3
Configure Environment Variables
For zsh (default shell on macOS):
echo 'export ANTHROPIC_BASE_URL="https://openapi.troncode.cn"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="your-api-key"' >> ~/.zshrc
source ~/.zshrc
For bash:
echo 'export ANTHROPIC_BASE_URL="https://openapi.troncode.cn"' >> ~/.bash_profile
echo 'export ANTHROPIC_AUTH_TOKEN="your-api-key"' >> ~/.bash_profile
source ~/.bash_profile
4
Verify and Get Started
claude --version
# Navigate to your project directory and launch
claude
Linux Installation
Method 1: One-Click Install (Recommended)
curl -fsSL https://claude.ai/install.sh | bash
Method 2: Manual Install
1
Install Node.js
Ubuntu / Debian:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
CentOS / RHEL:
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
sudo yum install -y nodejs
2
Install Claude Code
npm install -g @anthropic-ai/claude-code
3
Configure Environment Variables
For bash:
echo 'export ANTHROPIC_BASE_URL="https://openapi.troncode.cn"' >> ~/.bashrc
echo 'export ANTHROPIC_AUTH_TOKEN="your-api-key"' >> ~/.bashrc
source ~/.bashrc
4
Verify and Get Started
claude --version
cd /path/to/your/project
claude