Goal of this guide: install the Claude Code CLI on a Linux desktop, connect it to your own MYAI168 API, and use Claude Opus 4.8. (Ubuntu / Debian as the example.)
Claude Code speaks the Anthropic Messages protocol and connects to MYAI168's native Anthropic endpoint — no proxy needed. The key is supplied via an apiKeyHelper script — this is NOT a required setting (Claude Code officially supports setting the ANTHROPIC_API_KEY environment variable directly; apiKeyHelper is officially intended for dynamic / rotating credentials). This guide uses it so the key stays out of your shell environment variables and is easy to replace in one place.
The setup logic is the same as on macOS (apiKeyHelper + settings.json, base_url without /v1); use the Linux home-directory paths, and the shell config file depends on your shell.
https://www.myai168.com/en/api/anthropic (do not append /v1 at the end)claude-opus-4-8The base_url must end with .../anthropic — "never add /v1". Claude Code appends /v1/messages by itself; if the URL already contains /v1 the path becomes wrong, and you get a misleading "model does not exist" error. (This is the most common pitfall.)
First check Node (the official Claude Code npm package requires Node.js 22 or later; upgrade if yours is older):
node --version
npm --version
If missing, install it (Ubuntu / Debian):
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
Check your shell: echo $SHELL — bash → ~/.bashrc; zsh → ~/.zshrc.
Do not use sudo. If you hit an npm permission error, point the npm global directory to your home directory, then install:
npm install -g @anthropic-ai/claude-code
Verify:
claude --version
(If the command is not found: make sure ~/.local/bin or ~/.npm-global/bin is in PATH; for example:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
then check again.)
Create the key script (paste the whole block and press Enter once; replace the key with your real MYAI168 key):
mkdir -p ~/.claude
cat > ~/.claude/api-key-helper.sh << 'EOF'
#!/bin/bash
echo "your-MYAI168-key"
EOF
chmod +x ~/.claude/api-key-helper.sh
Verify it outputs the key (it should print your key string):
~/.claude/api-key-helper.sh
cc-switch is a cross-platform GUI; the Linux desktop interface is the same as on other platforms. (For installation, see the "cc-switch Linux" page in the Developer Center.)
myai168-claudehttps://www.myai168.com/en/api/anthropic (without /v1)Anthropic Messages (Native)ANTHROPIC_API_KEY (do not choose AUTH_TOKEN)claude-opus-4-8; set the Default fallback model to claude-opus-4-8 as well.{
"apiKeyHelper": "/home/your-account/.claude/api-key-helper.sh",
"env": {
"ANTHROPIC_BASE_URL": "https://www.myai168.com/en/api/anthropic",
"ANTHROPIC_MODEL": "claude-opus-4-8"
}
}
Verify the config file that was written (key points: the base URL does not contain /v1, apiKeyHelper is present, and ANTHROPIC_API_KEY is used):
cat ~/.claude/settings.json
Write settings.json with a heredoc (paste the whole block and press Enter; replace the account in the path with yours, which you can find with whoami):
cat > ~/.claude/settings.json << 'EOF'
{
"apiKeyHelper": "/home/your-account/.claude/api-key-helper.sh",
"env": {
"ANTHROPIC_BASE_URL": "https://www.myai168.com/en/api/anthropic",
"ANTHROPIC_MODEL": "claude-opus-4-8"
}
}
EOF
Note: once you use apiKeyHelper, do NOT also export ANTHROPIC_API_KEY, otherwise you get an Auth conflict.
(The Linux home directory is usually /home/account; if unsure, confirm with echo $HOME.)
Open a "brand-new" terminal (do not export any ANTHROPIC_* variables separately):
mkdir -p ~/cc-test
cd ~/cc-test
claude
After the first-run screens (theme, security, trust folder), type /status to confirm the endpoint and model, then ask a question; getting a reply means success.
Most common cause: /v1 was appended to the base_url. Change it to .../anthropic (without /v1). Second cause (Windows): a leftover .claude.json.backup interferes → delete it (Remove-Item -Force "$env:USERPROFILE\.claude.json.backup").
The apiKeyHelper is missing, or the helper does not output the key. Confirm the script exists, is executable (chmod +x), and settings.json has the apiKeyHelper field. The login menu only accepts official accounts — do not use it; skip it via apiKeyHelper.
Both apiKeyHelper and ANTHROPIC_API_KEY are set. Remove ANTHROPIC_API_KEY from env / your shell.
Wrong key. Check that the key inside the helper script is correct and has no extra spaces.
(Only when you have confirmed /v1 was not added and you still get 404) try changing the base URL to .../anthropic/v1 and test again; normally keep it without /v1.
Use /model to switch during a conversation; use /status to confirm the endpoint and model.
Update (the official docs say to use install @latest and to avoid npm update -g — it respects the semver range from the original install and may not move you to the newest release):
npm install -g @anthropic-ai/claude-code@latest
~/.claude/settings.json~/.claude/api-key-helper.sh