TutorialsQuickstartAPI Reference

Setup guides for tools and automation workflows.

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

  1. Go to the dashboard
  2. Sign up or log in to your account
  3. Navigate to API KeysCreate New Key
  4. 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-key

Then reload your shell:

source ~/.zshrc  # or ~/.bashrc

Windows (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_URL is 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