Claude
Claude Code
Install Claude Code and put the 2api address and key in settings.json. You don't need to sign in to an Anthropic account.
Before you start, create a key in the CC-Max group in the console. Claude Code can’t use a key from a GPT group.
Install
Section titled “Install”Use the official installer. Pick the one for your system:
curl -fsSL https://claude.ai/install.sh | bashirm https://claude.ai/install.ps1 | iexcurl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmdbrew install --cask claude-codewinget install Anthropic.ClaudeCodenpm install -g @anthropic-ai/claude-codeThe npm method needs Node.js 22 or later. Don’t use sudo.
After installing, reopen your terminal and run claude --version. If it prints a version number, you are set.
Configure
Section titled “Configure”-
Open
~/.claude/settings.json(on Windows,%USERPROFILE%\.claude\settings.json). Create it if it doesn’t exist, and write:~/.claude/settings.json {"env": {"ANTHROPIC_BASE_URL": "https://2api.dev","ANTHROPIC_AUTH_TOKEN": "sk-your-key","CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"}}- The address is the root address. Do not add
/v1. Claude Code adds/v1/messagesitself. - If the file already has other settings, merge these lines into
env. Don’t overwrite the whole file. - JSON doesn’t allow comments, and the last item can’t be followed by a comma.
- The address is the root address. Do not add
-
Configure first, then start. If you finish step 1 before you run
claudefor the first time, the login screen usually doesn’t appear. If it still gets stuck on the login screen or the screen for choosing a login method, open~/.claude.json(note that this is notsettings.json), add"hasCompletedOnboarding": trueat the top level, save, and start it again. This setting isn’t in the official documentation, but tools such as CC Switch use it the same way to skip the first-run setup. To restore the official login later, delete this line. -
Go to your project directory and start it:
Terminal window cd your-projectclaudeIn Claude Code, type
/status. If the Anthropic base URL showshttps://2api.dev, the configuration is in effect. Use/modelto switch models.
Try it temporarily
Section titled “Try it temporarily”Don’t change any files. Set the environment variables in the current terminal. They stop working when you close the window.
export ANTHROPIC_BASE_URL="https://2api.dev"export ANTHROPIC_AUTH_TOKEN="sk-your-key"export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1claude$env:ANTHROPIC_BASE_URL="https://2api.dev"$env:ANTHROPIC_AUTH_TOKEN="sk-your-key"$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1claudeset ANTHROPIC_BASE_URL=https://2api.devset ANTHROPIC_AUTH_TOKEN=sk-your-keyset CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1claudeIn CMD, don’t use quotes after the equals sign. The quotes become part of the value.
Model not found in background tasks
Section titled “Model not found in background tasks”Claude Code uses a smaller model for background tasks. If the error shows a model name you haven’t used (such as haiku), also set the background models to a model your group has:
{ "env": { "ANTHROPIC_BASE_URL": "https://2api.dev", "ANTHROPIC_AUTH_TOKEN": "sk-your-key", "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "a-model-in-your-group", "CLAUDE_CODE_SUBAGENT_MODEL": "a-model-in-your-group" }}Look up model names with /v1/models.
Next steps
Section titled “Next steps”- To use it in VS Code or Cursor: Claude Code extension
- If you get an error: Claude Code FAQ