Claude Code

Point Claude Code at this site with a one-click CC Switch import or environment variables.

Claude Code is Anthropic's official command-line coding agent and speaks the Anthropic protocol. It only needs two things: the address of this site and your key.

  • Protocol: Anthropic Messages
  • Base URL: https://tokenfunc.com (without /v1; Claude Code appends /v1/messages itself)
  • Models: the Claude family, for example claude-sonnet-4-5

Run the command below in a terminal, paste your key and pick a default model when asked. The script:

  • Checks the key against the model list endpoint (free of charge)
  • Installs Claude Code the official way if it is missing
  • Merges the base URL, key and model into ~/.claude/settings.json, keeping your other settings and backing up the original file

macOS / Linux

curl -fsSL https://tokenfunc.com/install/claude-code.sh | bash

Windows

# Run in PowerShell (not Command Prompt)
irm https://tokenfunc.com/install/claude-code.ps1 | iex

When it finishes, jump to the "Start and verify" step below.

Option 2: one-click import with CC Switch

CC Switch is a small desktop app that manages Claude Code and Codex settings. With it installed, the button below writes the address, key and model for you; no files to edit.

Screenshot pendingThe CC Switch import confirmation showing this site's address and the modeltools/claude-code-ccswitch.png

Enable the imported provider in CC Switch, then skip to the verify step below.

Option 3: manual setup

  1. Install Claude Code

    macOS / Linux

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

    Windows

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

    npm

    # Requires Node.js 22 or later
    npm install -g @anthropic-ai/claude-code

    On Windows, install Git for Windows first; Claude Code uses Bash to run commands.

  2. Write the settings file

    Open Claude Code's global settings file and add the content below. Create the file if it does not exist; if it already has content, merge these three entries into the existing env block.

    macOS / Linux

    ~/.claude/settings.json
    {
      "env": {
        "ANTHROPIC_BASE_URL": "https://tokenfunc.com",
        "ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxxxxxxxxxx",
        "ANTHROPIC_MODEL": "claude-sonnet-4-5"
      }
    }

    Windows

    %USERPROFILE%.claude\settings.json
    {
      "env": {
        "ANTHROPIC_BASE_URL": "https://tokenfunc.com",
        "ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxxxxxxxxxx",
        "ANTHROPIC_MODEL": "claude-sonnet-4-5"
      }
    }
  3. Start and verify

    Run claude in any project folder and type /status. If the "Anthropic base URL" line shows https://tokenfunc.com and the "Auth token" line says it comes from ANTHROPIC_AUTH_TOKEN, the settings are in effect. Ask it anything to confirm you get a reply.

    Screenshot pendingThe /status output in Claude Code with the Anthropic base URL and Auth token lines highlightedtools/claude-code-status.png

Choosing and switching models

  • The default model comes from ANTHROPIC_MODEL in the settings.
  • To switch once, start with claude --model claude-sonnet-4-5.
  • Claude Code runs small background tasks (titles, summaries) on a fast model. Set it with ANTHROPIC_DEFAULT_HAIKU_MODEL, for example a Haiku model from this site; the default is used otherwise.

Model names must match the Model Square exactly.

Using the VS Code extension

VS Code started from a desktop icon does not see variables you export in a terminal. Put the settings in ~/.claude/settings.json as above; the extension and the CLI share that file.

Troubleshooting

SymptomCause and fix
Still asks you to sign in to AnthropicThe settings are only in the project's .claude/settings.json. Put them in the global file in your home folder
"auth conflict" warningA claude.ai login is still stored on this machine. Run /logout in Claude Code
404ANTHROPIC_BASE_URL ends with /v1. Remove it
401Wrong key, or the key is out of quota. Check it on API Keys
Model not found / no available channelMisspelled model name, or the key's group does not include the model
400 ... context_management or Extra inputs are not permittedAdd "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1" to env
400 ... adaptiveThe model does not support adaptive thinking. Add "CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING": "1" to env

Other errors: see FAQ and troubleshooting.