Claude Code Setup
Guide to connecting Claude Code with AI Hub
Connect Claude Code to AI Hub using the API Key you received.
Environment Variables
Important: Use the configuration below for Claude Code. Replace
<your-api-key>with your API Key and keep all other values as-is.
export ANTHROPIC_AUTH_TOKEN="<your-api-key>"
export ANTHROPIC_BASE_URL="https://tokenhub.piegateway.me"
export ANTHROPIC_MODEL="claude-opus-4-6"
export ANTHROPIC_SMALL_FAST_MODEL="claude-haiku-4-5"
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-6"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5"
export CLAUDE_CODE_SUBAGENT_MODEL="claude-opus-4-6"
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1⚠️ CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 must be set. Without it, Claude Code enables experimental features (such as extended thinking) that use non-standard API formats, which will cause request parsing failures or errors when passing through the gateway.
Setup Steps
Step 1 — Check your shell type:
echo $SHELLStep 2 — Choose the correct config file:
zsh→ edit~/.zshrcbash→ edit~/.bash_profile
Step 3 — If you previously configured Claude Code / Anthropic / Bedrock, comment out the old ANTHROPIC_*, CLAUDE_CODE_*, and AWS_* variables to avoid conflicts.
Step 4 — Append the full configuration from the "Environment Variables" section above to the end of your config file, replacing <your-api-key> with your actual API Key.
Step 5 — Reload your config and start Claude Code:
source ~/.zshrc # or source ~/.bash_profile
claudeVerify Configuration
Check that environment variables are set:
echo $ANTHROPIC_BASE_URL
echo $ANTHROPIC_MODELVerify that the API Key works:
curl -s https://tokenhub.piegateway.me/v1/models \
-H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" | head -c 200If the model list is returned, the configuration is successful.
FAQ
Changes don't take effect — Usually caused by not reloading the config. Run source ~/.zshrc or source ~/.bash_profile.
Multiple old configs overriding each other — Check your config file for duplicate ANTHROPIC_*, CLAUDE_CODE_*, or AWS_* entries. Comment out the old ones and reload.