Claude Code
Use 678API in Claude Code
Claude Code can connect to a compatible gateway through environment variables.
Install and check
curl -fsSL https://claude.ai/install.sh | bash
claude doctorTemporary configuration
export ANTHROPIC_BASE_URL="https://www.678api.com"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
cd /path/to/your/project
claudeDo I need to sign out of Claude or Anthropic?
Usually not. These environment variables make this terminal use the 678API gateway. To restore the official service, run unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN and reopen Claude Code.
Persistent configuration
You can also add the variables to ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://www.678api.com",
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY"
}
}Keep the key private
Do not commit or share a settings file containing your API key.
Troubleshooting
- If Claude still asks for Anthropic login, reopen the terminal and inspect
env | grep ANTHROPIC. - For 401 errors, copy the key again and remove whitespace or a duplicated Bearer prefix.
- For model errors, confirm model availability and group permissions in the 678API console.