Quick Start
This guide will help you get started with Claude Code provided by AIHubMix in just a few minutes.1. Install Claude Code
Local Installation
winget upgrade Anthropic.ClaudeCode or brew upgrade claude-code periodically.
Install via npm
You need Node.js version 22 or higher.2. Configure AIHubMix API
To access AIHubMix’s model services via the compatible Anthropic API, you need to configure the following environment variables.- Set
ANTHROPIC_BASE_URLtohttps://aihubmix.com - Set
ANTHROPIC_AUTH_TOKENto the API Key obtained from the AIHubMix platform - Set
ANTHROPIC_MODELto a supported Claude model from the model list, such asclaude-sonnet-5-5.
- macOS
- Windows
- Run the following command in the terminal to check your default Shell type.
- Set the environment variables according to your Shell type using the following commands:
- Run the following command in the terminal to make the environment variables effective.
- Open a new terminal and run the following commands to check if the environment variables are effective.
If you plan to manage Claude Code through CC Switch, avoid setting global
ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, or ANTHROPIC_MODEL separately. System or user environment variables may override the Provider configuration written by CC Switch, so Claude Code may still use an old key or model even when the correct Provider is selected in the UI.3. Verify the Configuration
After configuring environment variables or CC Switch, run a minimal request first to confirm that the key, model, and Anthropic-compatible endpoint are available before starting a long session.200 and the content is 2, your AIHubMix key and Claude model are available. Then run:
2, Claude Code is configured successfully end to end.
4. Get Started
Once the configuration is complete, navigate to your working directory and run theclaude command in the terminal to start using Claude Code.
Not logged in · Please run /login, or opens Anthropic login options, Claude Code has not read your AIHubMix key.

- Confirm that the minimal request in the previous step returns
2. - Confirm that
ANTHROPIC_AUTH_TOKENis set where Claude Code can read it at startup: a terminal environment variable, or theenvblock in~/.claude/settings.json. After adding it to a profile such as~/.zshrc, open a new terminal before runningclaude. If it is set only in the project’s.claude/settings.jsonor.claude/settings.local.json, it takes effect only after first-run onboarding and the trust-folder prompt are complete, so the first launch still shows the login screen. - Check whether
ANTHROPIC_AUTH_TOKEN,ANTHROPIC_BASE_URL, orANTHROPIC_MODELis being overridden by old global environment variables.
claude again in the terminal.
(Optional) Additional Model Configuration Methods
Claude Code supports the following model configuration methods, ranked in order of priority from highest to lowest, where higher-priority configurations will override lower-priority ones.- During a conversation: Execute the
/model <model_name>command to switch models. The selected model is saved as the default for new sessions. To switch for the current session only, type/modelto open the model list and pressson the target model. IfANTHROPIC_MODELis set, new sessions still use the model specified by that variable.
- When starting Claude Code: Execute
claude --model <model_name>to specify the model. This is suitable for single-session use.
- Set the
ANTHROPIC_MODELenvironment variable: This applies globally.
- Permanently set in the settings.json configuration file: Write the
modelfield in the Claude Code user settings file, such as~/.claude/settings.jsonon macOS/Linux orC:\Users\%USERNAME%\.claude\settings.jsonon Windows, or in a project-level configuration. This sets the model permanently at the user level or project level. WhenANTHROPIC_MODELis set, themodelfield does not take effect.
ANTHROPIC_DEFAULT_FABLE_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, and ANTHROPIC_DEFAULT_HAIKU_MODEL specify the model IDs for the fable, opus, sonnet, and haiku aliases. They are not part of the priority order above. The main conversation always uses the currently selected model.
ANTHROPIC_DEFAULT_FABLE_MODEL: The model for thefablealias.ANTHROPIC_DEFAULT_OPUS_MODEL: The model for theopusalias.opusplanalso uses this model in Plan mode.ANTHROPIC_DEFAULT_SONNET_MODEL: The model for thesonnetalias.opusplanuses this model outside Plan mode.ANTHROPIC_DEFAULT_HAIKU_MODEL: The model for thehaikualias. Claude Code background tasks also use this model.
When the same variable is set both in the terminal environment and in the
env section of settings.json, the value in settings.json takes precedence. If the model you set in the terminal does not take effect, check whether ANTHROPIC_MODEL is set in the env section of settings.json.env section of ~/.claude/settings.json, for example:
<AIHUBMIX_API_KEY> with your real key. After saving, restart Claude Code and enter /model to check the models available for the current session.
How to Configure via CC Switch?
- Run CC Switch, select Claude Code on the left, then click “Add Provider”.

- Select “AiHubMix” from the preset list. Make sure you are configuring the Provider for Claude Code.

- Enter your real key in the “API Key” field.

-
Scroll down to “Model Mapping”. In the Sonnet, Opus, and Haiku rows, enter
claude-sonnet-5-5,claude-opus-5-5, andclaude-haiku-5-5respectively in both “Display name” and “Requested model”, and leave the other rows empty. Set “Default fallback model” toclaude-sonnet-5-5. Click “Add” to save the settings. You can then switch between these models in Claude Code with/model.
- Return to the homepage and click the ▷ button (Switch) on the right side of the “AiHubMix” card. When the card shows “In use”, Claude Code is using this provider.

How to Configure through the VS Code Plugin?
- Run VS Code and install the plugin.

- Press
Ctrl + Shift + P(orCmd + Shift + P), typeSettingsto open the settings.

- Search for
Claude Code, findClaude Code: Environment Variable→Edit in settings.json.

- Fill in the AIHubMix settings in
claudeCode.environmentVariables, and setclaudeCode.disableLoginPrompttotrueto skip the extension’s login prompt.

FAQ
Q: What should I do if I get a 401 authentication error?
401 means the request did not pass authentication, but the exact cause depends on the full error message:
no key provided: the request did not include a key. Open Claude Code, enter/status, and confirm that theAnthropic base URLline showshttps://aihubmix.comand that theAuth tokenorAPI keyline shows a variable name such asANTHROPIC_AUTH_TOKEN.invalid key: AIHUBMIX_API_KEY: this usually means the placeholder from the example was copied as-is. Copy your real key again from the AIHubMix console and updateANTHROPIC_AUTH_TOKEN.this key is not enabled: the request reached AIHubMix, but the current key is not enabled or does not have permission. Check whether the key is enabled, expired, has quota, and can call the selected Claude model in the AIHubMix console.
ANTHROPIC_* variables so the current Provider in CC Switch can take over.
Note: /v1/models may return a model list even without a valid key, so do not use it to determine whether the key is usable. Use the minimal message request in “Verify the Configuration” above. If it returns 200 and the content is 2, the key and model are usable. Then restart Claude Code or restart it through CC Switch.
Q: What should I do if I get 400 Incorrect model ID or Bad request (400)?
This usually means the request reached the provider side, but the model ID is incorrect, the model name does not match the interface, or the current key does not have permission to call that model. Copy the full model ID again from the AIHubMix model list, and make sure there are no manual spelling, capitalization, or model-family mistakes.
If you configure through CC Switch, return to the corresponding Provider, update the model ID, save it, and restart Claude Code. If the error persists, first use a Claude model confirmed available in the model list to complete the health check, then switch to the target model.
Q: After successfully installing on macOS, I still get an error: zsh: command not found: claude
This is because the Claude CLI is installed, but its executable directory is not added to the system PATH.
- Confirm the Claude installation path. The official install script installs
claudeto the following location:
- macOS / Linux:
~/.local/bin/claude - Windows:
%USERPROFILE%\.local\bin\claude.exe
- Add the installation directory to the PATH:
- Verify if it takes effect. Execute:
claude path and version number, the installation was successful.
Q: Claude Code Unable to Connect to Anthropic Services
After upgrading to the latest version of Claude Code, if you encounter issues connecting to Anthropic services or authentication failures, first check that the authentication variable is configured correctly. Claude Code supports two authentication variables:ANTHROPIC_AUTH_TOKEN sends the key in the Authorization: Bearer request header, and ANTHROPIC_API_KEY sends the key in the x-api-key request header. AIHubMix accepts both, and this document uses ANTHROPIC_AUTH_TOKEN throughout. For specific instructions, please refer to this document for reconfiguration.