Skip to main content

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

The first three are the official native installers and update automatically in the background. WinGet and Homebrew installations do not update automatically, so run 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.
  1. Set ANTHROPIC_BASE_URL to https://aihubmix.com
  2. Set ANTHROPIC_AUTH_TOKEN to the API Key obtained from the AIHubMix platform
  3. Set ANTHROPIC_MODEL to a supported Claude model from the model list, such as claude-sonnet-5-5.
AIHUBMIX_API_KEY is only a placeholder. Replace it with your real key, usually starting with sk-. If you copy it as-is, Claude Code will treat it as the actual key and return 401 invalid key: AIHUBMIX_API_KEY.
  1. Run the following command in the terminal to check your default Shell type.
  1. Set the environment variables according to your Shell type using the following commands:
  1. Run the following command in the terminal to make the environment variables effective.
  1. 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.
If the request returns 200 and the content is 2, your AIHubMix key and Claude model are available. Then run:
If it returns 2, Claude Code is configured successfully end to end.

4. Get Started

Once the configuration is complete, navigate to your working directory and run the claude command in the terminal to start using Claude Code.
If startup shows Not logged in · Please run /login, or opens Anthropic login options, Claude Code has not read your AIHubMix key. Claude Code terminal screen showing first-run login or setup options Check the following in order:
  1. Confirm that the minimal request in the previous step returns 2.
  2. Confirm that ANTHROPIC_AUTH_TOKEN is set where Claude Code can read it at startup: a terminal environment variable, or the env block in ~/.claude/settings.json. After adding it to a profile such as ~/.zshrc, open a new terminal before running claude. If it is set only in the project’s .claude/settings.json or .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.
  3. Check whether ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, or ANTHROPIC_MODEL is being overridden by old global environment variables.
After making these changes, run 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.
  1. 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 /model to open the model list and press s on the target model. If ANTHROPIC_MODEL is set, new sessions still use the model specified by that variable.
  1. When starting Claude Code: Execute claude --model <model_name> to specify the model. This is suitable for single-session use.
  1. Set the ANTHROPIC_MODEL environment variable: This applies globally.
  1. Permanently set in the settings.json configuration file: Write the model field in the Claude Code user settings file, such as ~/.claude/settings.json on macOS/Linux or C:\Users\%USERNAME%\.claude\settings.json on Windows, or in a project-level configuration. This sets the model permanently at the user level or project level. When ANTHROPIC_MODEL is set, the model field 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.
Where:
  • ANTHROPIC_DEFAULT_FABLE_MODEL: The model for the fable alias.
  • ANTHROPIC_DEFAULT_OPUS_MODEL: The model for the opus alias. opusplan also uses this model in Plan mode.
  • ANTHROPIC_DEFAULT_SONNET_MODEL: The model for the sonnet alias. opusplan uses this model outside Plan mode.
  • ANTHROPIC_DEFAULT_HAIKU_MODEL: The model for the haiku alias. 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.
You can also put all of your AIHubMix settings in the env section of ~/.claude/settings.json, for example:
Replace <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?

  1. Run CC Switch, select Claude Code on the left, then click “Add Provider”.
CC Switch homepage showing the Add Provider button
  1. Select “AiHubMix” from the preset list. Make sure you are configuring the Provider for Claude Code.
CC Switch provider list with AiHubMix selected
  1. Enter your real key in the “API Key” field.
CC Switch AiHubMix configuration form with API Key field
  1. Scroll down to “Model Mapping”. In the Sonnet, Opus, and Haiku rows, enter claude-sonnet-5-5, claude-opus-5-5, and claude-haiku-5-5 respectively in both “Display name” and “Requested model”, and leave the other rows empty. Set “Default fallback model” to claude-sonnet-5-5. Click “Add” to save the settings. You can then switch between these models in Claude Code with /model.
    CC Switch Model Mapping with Claude model IDs filled in
  2. 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.
CC Switch homepage with AiHubMix shown as in use
If CC Switch shows a system environment variable conflict, handle ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, and ANTHROPIC_MODEL first. These global variables can override the current Provider configuration. Placeholder values such as ANTHROPIC_AUTH_TOKEN=AIHUBMIX_API_KEY will directly cause authentication failures. After confirming you no longer need the global variables, delete the conflicting items in CC Switch or remove the system/user environment variables manually, then restart the terminal.

How to Configure through the VS Code Plugin?

  1. Run VS Code and install the plugin.
VS Code Extensions view installing the Claude Code plugin
  1. Press Ctrl + Shift + P (or Cmd + Shift + P), type Settings to open the settings.
VS Code command palette opening Settings
  1. Search for Claude Code, find Claude Code: Environment Variable → Edit in settings.json.
VS Code settings search for Claude Code environment variables
  1. Fill in the AIHubMix settings in claudeCode.environmentVariables, and set claudeCode.disableLoginPrompt to true to skip the extension’s login prompt.
VS Code settings.json example for Claude Code environment variables

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 the Anthropic base URL line shows https://aihubmix.com and that the Auth token or API key line shows a variable name such as ANTHROPIC_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 update ANTHROPIC_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.
On Windows, also check whether old values remain in user or system environment variables:
If you use CC Switch to manage configuration, delete these global 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.
  1. Confirm the Claude installation path. The official install script installs claude to the following location:
  • macOS / Linux: ~/.local/bin/claude
  • Windows: %USERPROFILE%\.local\bin\claude.exe
Run the following command in the terminal:
If you see the claude file, it means the installation was successful, but the PATH is not configured.
  1. Add the installation directory to the PATH:
  1. Verify if it takes effect. Execute:
If you can see the 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.

More Resources

Happy coding!

Last updated: 2026-10-20