TronCode Docs TronCode API

TronCode API Usage Guide

Use Claude Code and other AI tools via TronCode API endpoints without directly accessing Anthropic services. Simply set the ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN environment variables to get started.

ℹ️
TronCode API endpoint: https://openapi.troncode.cn
Please register and obtain an API Key on the TronCode Platform before use.

Windows Installation

Method 1: One-Click Install (Recommended)

Run the following command in PowerShell to automatically install Node.js and Claude Code:

powershell
curl -fsSL https://claude.ai/install.sh | bash
⚠️
This command requires access to the international network. Please ensure your network can access claude.ai. If you cannot access it directly, you will need to use a proxy tool.

Method 2: Manual Installation

1
Install Node.js

Visit the Node.js download page, download the LTS version, and double-click the .msi installer to complete installation following the wizard.

2
Install Claude Code

Open PowerShell and run:

powershell
npm install -g @anthropic-ai/claude-code
⚠️
If you encounter an "Execution Policy" error, open PowerShell as Administrator and run: Set-ExecutionPolicy RemoteSigned, type Y to confirm, then retry the installation.
3
Configure Environment Variables

Run in PowerShell (permanent setting):

powershell
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://openapi.troncode.cn", "User")
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "YOUR_API_KEY", "User")

Or set temporarily (current session only):

powershell
$env:ANTHROPIC_BASE_URL = "https://openapi.troncode.cn"
$env:ANTHROPIC_AUTH_TOKEN = "YOUR_API_KEY"
4
Verify Installation
powershell
claude --version
If a version number is displayed, the installation was successful!
5
Get Started
powershell
# Navigate to your project directory
cd C:\path\to\your\project

# Start Claude Code
claude

macOS Installation

Method 1: One-Click Install (Recommended)

Open Terminal and run:

bash
curl -fsSL https://claude.ai/install.sh | bash
⚠️
This command requires access to the international network. Please ensure your network can access claude.ai.

Method 2: Manual Installation

1
Install Node.js

Recommended using Homebrew:

bash
brew install node

Or download the .pkg installer from the official website.

2
Install Claude Code
bash
npm install -g @anthropic-ai/claude-code
3
Configure Environment Variables

For zsh (macOS default shell):

zsh
echo 'export ANTHROPIC_BASE_URL="https://openapi.troncode.cn"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"' >> ~/.zshrc
source ~/.zshrc

For bash:

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
bash
claude --version
# Navigate to your project directory, then start
claude

Linux Installation

Method 1: One-Click Install (Recommended)

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

Method 2: Manual Installation

1
Install Node.js

Ubuntu / Debian:

bash
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

CentOS / RHEL:

bash
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
sudo yum install -y nodejs
2
Install Claude Code
bash
npm install -g @anthropic-ai/claude-code
3
Configure Environment Variables

For bash:

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
bash
claude --version
cd /path/to/your/project
claude