Skip to main content

Claude Code

Claude Code supports custom API endpoints via environment variables or a configuration file. When configured with CloudBase, it consumes tokens from your CloudBase Token Resource Pack.

Prerequisites

  1. A CloudBase environment with its Environment ID (ENV_ID)
  2. A Token Resource Pack purchased
  3. Enable the required models in Console → AI → Text Models
  4. A CloudBase API Key (Console → Environment Settings → API Key)

Option 1: Environment Variables

Temporary Setup (current shell session)

export ANTHROPIC_BASE_URL="https://<ENV_ID>.api.tcloudbasegateway.com/v1/ai/cloudbase"
export ANTHROPIC_AUTH_TOKEN="<YOUR_CLOUDBASE_API_KEY>"
claude

Persistent Setup (shell profile)

echo 'export ANTHROPIC_BASE_URL="https://<ENV_ID>.api.tcloudbasegateway.com/v1/ai/cloudbase"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="<YOUR_CLOUDBASE_API_KEY>"' >> ~/.zshrc
source ~/.zshrc

Option 2: settings.json Configuration File

Claude Code supports persisting configuration in a settings.json file without modifying your shell profile.

Configuration file path:

  • macOS / Linux: ~/.claude/settings.json
  • Windows: %APPDATA%\Claude\settings.json

Add the following content:

{
"env": {
"ANTHROPIC_BASE_URL": "https://<ENV_ID>.api.tcloudbasegateway.com/v1/ai/cloudbase",
"ANTHROPIC_AUTH_TOKEN": "<YOUR_CLOUDBASE_API_KEY>"
}
}

Thinking Mode

The Hunyuan Hy3 model defaults to no_think mode (extended thinking disabled) for faster responses. To enable deep reasoning, run the /config command in Claude Code and toggle the thinking option on.

note

When using a third-party model, Claude Code's built-in web search is unavailable. For search capabilities, connect to CloudBase AI Search via MCP.