OpenOx / Tutorials
All tutorialsAPI keys
Tutorials/Claude/macOS
Claude/macOS/4 min read

Claude Code

Install and configure Claude Code on macOS.

On this page
1. Install the Basic Environment2. Install Claude Code3. Configure CC Switch

Note: The easiest method is to ask ChatGPT to download Claude Code for you

For Mac users. After completing this tutorial, you will be able to use Claude Code in the Mac terminal and manage your openox API Key configuration through CC Switch.

Before you begin, make sure that:

  1. You have registered an openrouter account.
  2. You have created an API Key.
  3. An API Key is usually a string beginning with sk.
  4. Your account has a sufficient balance.

1. Install the Basic Environment

  1. Open the Mac terminal.

Click the search button in the upper-right corner of your Mac, or press:

Command + Space

Search for:

Terminal

Then open [Terminal]


  1. Check whether Homebrew is already installed.

Enter the following command in the terminal:

brew -v

If a version number appears, Homebrew is installed and you can proceed to the next step.

If you see command not found: brew, Homebrew is not installed and you need to install it first.


  1. Install Homebrew.

Copy and run the following command in the terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

After running it, follow the prompts in the terminal.

If you are prompted for a password, enter your Mac login password.

Note: The terminal does not display any characters while you enter your password. This is normal. Press Enter when you have finished typing.

Important:

After Homebrew is installed, if Next steps appears in the terminal, first copy and run the commands it provides.

First, copy and run the first line:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile

When it finishes, copy and run the second line:

eval "$(/opt/homebrew/bin/brew shellenv)"

When it finishes, enter the following command to check:

brew -v

If the Homebrew version number appears, Homebrew has been configured successfully and you can proceed to the next step.

If you still see command not found: brew, close and reopen the terminal, then enter brew -v again to check.


  1. Install Git and the Node.js environment.

After confirming that brew -v displays a version number correctly, copy and run the following command in the terminal:

brew install git node

Wait for the installation to finish. Do not close the terminal.


  1. Check whether the environment was installed successfully.

After installation, enter the following commands one at a time:

git --version
node -v
npm -v

If all three commands display version numbers, the basic environment has been installed successfully.

Note: If you see command not found, close and reopen the terminal, then enter the commands again to test.


2. Install Claude Code

  1. Copy and run the following command in the terminal:
npm install -g @anthropic-ai/claude-code

Installation may take 1-3 minutes. Please wait patiently and do not close the terminal.


  1. After installation, enter the following command to check whether it was successful:
claude --version

If a version number appears, Claude Code has been installed successfully.

Note: If you see claude: command not found, first close and reopen the terminal, then enter claude --version to test.

3. Configure CC Switch

Mac installation package:

Open CC Switch and go to the configuration page.

CC-Switch-v3.14.0-macOS.zip

  1. Download and install CC Switch, then open the application. On the home page, click the [+] add button in the upper-right corner to open the provider configuration page
Claude Code setup screenshot
Claude Code setup screenshot
  1. Follow the prompts on the page to enter the OpenOx configuration: enter Openox as the provider name; enter the key beginning with sk that you created earlier as the API Key; enter https://api.openoxai.com/ as the request URL, without adding /v1 at the end. When finished, click [Save] in the lower-right corner
Claude Code setup screenshot
Claude Code setup screenshot
  1. After saving, return to the CC Switch home page, select the OpenOx configuration you just created, and make sure it is enabled. Once configuration is complete, open Claude Code to test it.
  2. Test whether Claude Code works.

Close and reopen PowerShell, then enter:

  • Note: The 4.7 model consumes more credits. When using it for the first time, you can enter /model and press Enter to switch to another model!
  • Keep an eye on the conversation length in each chat window. Overly long conversations consume credits faster, slow down responses, and reduce output quality. When a conversation gets long, enter compact to compress the context, then copy the summary into a new window to continue.
claude

If you can access the Claude Code interface normally, the configuration is successful

Claude Code setup screenshot
Claude Code setup screenshot
Claude Code setup screenshot
Claude Code setup screenshot

Notes:

1. CC Switch is only a configuration management tool; it is not a model platform itself.

2. The API Key is the Token Key created earlier and usually begins with sk.

3. Once generated, a Key can be used long term. When your balance is low, you only need to top up. The original Key remains usable and does not need to be recreated or replaced.

4. If it does not work after configuration, check whether the API Key was copied in full, whether your balance is sufficient, and whether the Base URL is set to https://api.openoxai.com/

Common Reasons for Configuration Failure

  1. The configuration file was not saved, so the configuration did not take effect. Usually, clicking Save and fully exiting the application, or switching networks and reopening it, resolves the issue.
  2. If it still does not work after completing the first step, there is a local file conflict. Following the image below, go to the user/.Claude/ directory and find the corresponding Setting.json file. Clear the original configuration, paste in the configuration from the main text, replace the KEY, then save and exit for it to take effect. (Refer to the Windows image below; the same applies to Mac.)
Claude Code setup screenshot
Claude Code setup screenshot
Browse all tutorials

On this page

1. Install the Basic Environment2. Install Claude Code3. Configure CC Switch