Claude Code
Claude Code Custom API Guide
Configure Claude Code to use the OurToken API and spend from your OurToken account balance in about 3 minutes.
Before you start: two values you need
| Setting | Value | Where to get it |
|---|---|---|
ANTHROPIC_BASE_URL | https://api.ourtoken.ai | Copy this value directly |
ANTHROPIC_AUTH_TOKEN | Your OurToken API Key | Create it on the OurToken API Keys page |
Important
ANTHROPIC_BASE_URLshould be exactly:texthttps://api.ourtoken.aiDo not append
/v1/messages. Claude Code adds the request path automatically.
Step 1: Install Claude Code
Mac users
Open Terminal, then paste and run:
curl -fsSL https://claude.ai/install.sh | bash
After installation, add Claude Code to your system PATH so the claude command can run:
p="$HOME/.local/bin"; grep -qxF 'export PATH="$HOME/.local/bin:$PATH"' "$HOME/.zshrc" 2>/dev/null || echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.zshrc"; export PATH="$p:$PATH"; claude --version
Windows users
Search for PowerShell in the Start menu, open it, then paste and run:
irm https://claude.ai/install.ps1 | iex
After installation, add Claude Code to your system PATH so the claude command can run:
$p="$env:USERPROFILE\.local\bin"; $u=[Environment]::GetEnvironmentVariable("Path","User"); if (($u-split";")-notcontains$p){[Environment]::SetEnvironmentVariable("Path",$u.TrimEnd(";")+";"+$p,"User")}; $env:Path+=";$p"; claude --version
Run:
claude --version
If the version number appears, installation is complete.
Claude Code version screenshot
⚠️ If the
claudecommand does not run, check whether Claude Code has been added to your systemPATH.⚠️ After installation, do not sign in with an Anthropic account. The next step connects Claude Code directly with your OurToken API Key.
Step 2: Configure OurToken credentials
After Claude Code is installed, open the following configuration file. If the file or folder does not exist, create it manually.
Configuration file path
-
Mac:
text~/.claude/settings.json -
Windows:
textC:\Users\<username>\.claude\settings.json
For Windows, replace <username> with your Windows username.
Paste the following into settings.json, then replace your ourtoken api key with your OurToken API Key:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your ourtoken api key",
"ANTHROPIC_BASE_URL": "https://api.ourtoken.ai",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-opus-4-8",
"ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME": "claude-opus-4-8",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-8",
"ANTHROPIC_DEFAULT_OPUS_MODEL_NAME": "claude-opus-4-8",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6",
"ANTHROPIC_DEFAULT_SONNET_MODEL_NAME": "claude-sonnet-4-6",
"ANTHROPIC_MODEL": "claude-sonnet-4-6",
"ENABLE_TOOL_SEARCH": "true"
},
"model": "sonnet",
"effortLevel": "medium",
"autoUpdatesChannel": "latest"
}
Note
You can replace the models in the configuration file with other supported models. Check the current model list on the OurToken API Keys page.
OurToken model list screenshot
Step 3: Verify the configuration
Open Terminal or PowerShell and run this command in any directory:
claude
After entering the Claude Code interface, send a simple message:
Hello
If Claude Code replies normally, it is connected to the OurToken API.
You can also sign in to OurToken and check the Dashboard for API call records and cost details.
- ✅ Claude Code replies normally
- ✅ API usage appears in the OurToken Dashboard
- ✅ Your account balance is charged correctly
Once all checks pass, you can start using Claude Code.
Next: use VS Code plugin and Claude Code client
After this setup, you can also use Claude Code directly in the VS Code + Claude Code plugin or in the Claude Code client. They reuse the OurToken credentials already configured on your machine, so you do not need to configure them again.