How to Use ToksHub with Claude Code
Route Claude Code through the same API boundary your application stack already uses.
Step 1: Get Your API Key
- Go to the dashboard
- Sign up or log in to your account
- Navigate to API Keys → Create New Key
- Copy the key (starts with
sk-)
Step 2: Configure Claude Code
Set two environment variables to redirect Claude Code through ToksHub:
macOS / Linux
Add to your ~/.bashrc, ~/.zshrc, or ~/.profile:
export ANTHROPIC_BASE_URL=https://api.tokshub.com/v1
export ANTHROPIC_API_KEY=sk-your-keyThen reload your shell:
source ~/.zshrc # or ~/.bashrcWindows (PowerShell)
$env:ANTHROPIC_BASE_URL = "https://api.tokshub.com/v1"
$env:ANTHROPIC_API_KEY = "sk-your-key"Step 3: Verify
claude "Hello, can you confirm this connection is working?"If you see a response, you're all set! Check your dashboard to see the request logged.
Troubleshooting
- Connection refused — Verify
ANTHROPIC_BASE_URLis set correctly (no trailing slash) - Invalid API key — Ensure you're using yourToksHub key, not your Anthropic key
- Slow responses — Check your connection and review status
- Env vars not taking effect — Restart your terminal after setting variables