Skip to main content

Claude Code

Claude Code is an AI that runs in the terminal. A programming agent can directly read local codebases, interact with developers using natural language, and autonomously complete complex development tasks such as code reading, multi-file modification, test execution, and command running.

After installing Claude Code, you can configure a custom model by following the steps below to use it, without needing to log in to an Anthropic account.

Prerequisites

  • You have activated a TCB environment and obtained the environment ID cloudBaseEnvID.

  • Enable the required model in the AI console.

  • Obtain the Base URL and API Key in the AI console.

codebuddy

Configuration Steps

This document uses Claude Code-v2.1.170 as an example.

Configuration Field Mapping Table

Environment VariableDescription
ANTHROPIC_BASE_URLThe Base URL for the large model, which is obtained in the AI console.
ANTHROPIC_AUTH_TOKENThe API Key for calling the large model, which is obtained in the AI console.
ANTHROPIC_MODELThe large model ID. Copy the identifier of an enabled large model from the model list in the AI console and enter it here.
  1. Open or create your Claude Code configuration file.
note

If you use your file browser to locate files, note that the file browser hides files with names starting with a period (.) by default. You may need to enable the hidden files option in your file browser to view them.

On macOS, use the Finder shortcut Command + Shift + . to show hidden files. On Windows, you can show hidden items by selecting "File Explorer - View - Show - Hidden items". If you cannot find the file, ensure that Claude Code has been installed and opened at least once.

Mac/Linux (~ represents your current user directory)

~/.claude/settings.json

Windows

C:\Users\YourUsername\.claude\settings.json
  1. Add or replace the env field as follows:
{
"env": {
"ANTHROPIC_BASE_URL": "https://{{cloudBaseEnvID}}.api.tcloudbasegateway.com/v1/ai/cloudbase",
"ANTHROPIC_AUTH_TOKEN": "eyJhbGciOiJSUzI1N...",
"ANTHROPIC_MODEL": "hy3-preview"
}
}

Additional Configuration

You can find configuration instructions for more models on the Claude Code official website.

note

After connecting to a third-party model, the built-in web search feature in Claude Code becomes unavailable. If you require search capabilities, you can use MCP. Connect to the TCB AI Search Service.

Usage

Navigate to the specified directory in the terminal and enter the claude command to use the configured custom TCB large model. For more commands and features, refer to the official documentation.

claude

Claude Code

Common Error Troubleshooting

Error MessageSolution
429 Token usage exceeded quota limitTokens are exhausted or not enabled.
401 Credentials are invalidThe API Key is entered incorrectly or may have been deleted.
429 API Error: Request rejectedAn incorrect large model name is configured, or the large model is not enabled in the AI console.