Set up Claude Code

Anthropic's terminal coding agent. Set two environment variables to run it on CherryChat's Claude models

Steps

  1. Install Claude Code (skip if installed)

    Open Terminal on macOS or PowerShell on Windows, paste the matching command and press Enter. Run claude --version afterwards to confirm. If the script download fails, install with npm instead (requires Node.js 22 or later).

    macOS / Linux

    curl -fsSL https://claude.ai/install.sh | bash

    Windows (PowerShell)

    irm https://claude.ai/install.ps1 | iex

    Or install with npm

    npm install -g @anthropic-ai/claude-code
  2. Option 1 (recommended): settings.json

    Open ~/.claude/settings.json in your home folder (%USERPROFILE%\.claude\settings.json on Windows) with the command below and paste the block in. If the file already has content, merge only the "env" section instead of overwriting it. The file is strict JSON: no comments and no trailing commas. This applies to every terminal and to the VS Code / JetBrains extensions.

    • ANTHROPIC_BASE_URL (API address): https://gpt.cherrychat.org (Domain only, without /v1)
    • ANTHROPIC_AUTH_TOKEN (API key): sk-your-key
    • ANTHROPIC_MODEL (main model): claude-sonnet-5-5
    • ANTHROPIC_DEFAULT_HAIKU_MODEL (background model): claude-haiku-5-5 (Used for titles, summaries and other background tasks; cheap and fast)

    Open the file (macOS)

    mkdir -p ~/.claude && touch ~/.claude/settings.json && open -e ~/.claude/settings.json

    Open the file (Windows)

    mkdir $HOME\.claude -Force; notepad $HOME\.claude\settings.json

    settings.json content

    {
      "env": {
        "ANTHROPIC_BASE_URL": "https://gpt.cherrychat.org",
        "ANTHROPIC_AUTH_TOKEN": "sk-your-key",
        "ANTHROPIC_MODEL": "claude-sonnet-5-5",
        "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5"
      }
    }
  3. Option 2: environment variables

    Use this if you prefer not to edit settings.json. "Permanent" appends to ~/.zshrc (use ~/.bashrc for bash) or uses setx on Windows; reopen the terminal afterwards. "This window only" is handy for a quick try and disappears when the window closes. Pick one option, not both.

    Permanent (append to ~/.zshrc)

    cat >> ~/.zshrc <<'EOF'
    export ANTHROPIC_BASE_URL="https://gpt.cherrychat.org"
    export ANTHROPIC_AUTH_TOKEN="sk-your-key"
    export ANTHROPIC_MODEL="claude-sonnet-5-5"
    export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-5-5"
    EOF
    source ~/.zshrc

    This window only

    export ANTHROPIC_BASE_URL="https://gpt.cherrychat.org"
    export ANTHROPIC_AUTH_TOKEN="sk-your-key"
    export ANTHROPIC_MODEL="claude-sonnet-5-5"
    export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-5-5"
    claude

    Permanent (setx, then reopen PowerShell)

    setx ANTHROPIC_BASE_URL "https://gpt.cherrychat.org"
    setx ANTHROPIC_AUTH_TOKEN "sk-your-key"
    setx ANTHROPIC_MODEL "claude-sonnet-5-5"
    setx ANTHROPIC_DEFAULT_HAIKU_MODEL "claude-haiku-5-5"

    This window only

    $env:ANTHROPIC_BASE_URL = "https://gpt.cherrychat.org"
    $env:ANTHROPIC_AUTH_TOKEN = "sk-your-key"
    $env:ANTHROPIC_MODEL = "claude-sonnet-5-5"
    $env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "claude-haiku-5-5"
    claude
  4. Verify the connection

    Open a new terminal, go to your project folder and run the command below; a reply means it works. Inside claude, type /status: the "Anthropic base URL" line should show https://gpt.cherrychat.org and the "Auth token" line should name ANTHROPIC_AUTH_TOKEN.

  5. If it asks you to log in

    A login screen means Claude Code did not pick up ANTHROPIC_AUTH_TOKEN. Make sure you started it from a terminal opened after the change, or use option 1 and put it in ~/.claude/settings.json. You do not need an Anthropic account. If you used to sign in with claude.ai and see a warning about two credentials, run /logout inside Claude Code.

  6. Use it in the VS Code extension (optional)

    The VS Code extension checks credentials before it starts, so add them to VS Code settings too: press Cmd/Ctrl + Shift + P, run "Preferences: Open User Settings (JSON)", add the block below inside the outer braces, save and restart VS Code.

    "claudeCode.environmentVariables": [
      { "name": "ANTHROPIC_BASE_URL", "value": "https://gpt.cherrychat.org" },
      { "name": "ANTHROPIC_AUTH_TOKEN", "value": "sk-your-key" },
      { "name": "ANTHROPIC_MODEL", "value": "claude-sonnet-5-5" },
      { "name": "ANTHROPIC_DEFAULT_HAIKU_MODEL", "value": "claude-haiku-5-5" }
    ]

Common pitfalls

Error → cause → fix

What you seeWhyWhat to do
HTTP 401 / Invalid bearer tokenThe key is mistyped, has extra spaces, or was disabled / deleted; or it went into ANTHROPIC_API_KEY by mistakeCopy the key again from My Keys on the API page into ANTHROPIC_AUTH_TOKEN, then retry in a new terminal
HTTP 404 Not FoundANTHROPIC_BASE_URL was set to https://gpt.cherrychat.org/v1 or includes /messages, so the path is doubledChange it to the domain only: https://gpt.cherrychat.org
"There's an issue with the selected model" or model not foundANTHROPIC_MODEL is misspelled (case, spaces) or names a model CherryChat does not offerUse a name from the Models page, e.g. claude-sonnet-5-5 (all lowercase)
HTTP 402 or "insufficient balance" (billing_error in Claude format)Your credits cannot cover this call. API calls are paid from credits only; memberships and unlimited plans do not applyTop up any amount in the CherryChat Store, then retry after a few seconds
HTTP 429 Too Many RequestsToo many requests: by default 120 per minute per key and 8 at a time per accountLower the concurrency or requests per second in the tool and wait for the Retry-After seconds; most tools retry on their own
Spins for a long time, then a connection error or timeout (ECONNREFUSED, ENOTFOUND, timeout)The address is misspelled, is missing https://, or your network cannot reach the domainOpen https://gpt.cherrychat.org/v1/models in a browser. Any JSON reply, even an error, means the network path works; then recheck the address in the tool character by character

Guide checked 2026-11-02. The tool's screens may change; the official docs win if they differ.

API · API Pricing

Operated by UK Company CHERRYCHAT LTD · Company Number 16096119 · Support WeChat: JsnonoChat · Content is AI-generated — please verify before relying on it

CherryChat

The network is slow. Still loading…