[KongchangAI]
· 2 min read· 1,101 words

Claude Code Anti-Ban Installation Guide: Bypassing Login with ccswitch

Claude Code Anti-Ban Installation Guide: Bypassing Login with ccswitch

UP host's tested method: install Claude Code via npm, then use ccswitch with third-party keys to bypass login and avoid ban risk.

The article relays a public class by Instructor Lian of "码氏兵教育" on Bilibili, covering the full path for domestic developers using Claude Code. For installation, official PowerShell/CMD methods are unstable on domestic networks, so npm is recommended, requiring only Node.js 22+ and Git, verified with `claude --version`. For login, both official account login and API Key environment variables carry ban risk—the author was banned multiple times. The core solution is the open-source tool ccswitch, which bypasses login by configuring third-party provider API keys (e.g., DeepSeek, Zhipu); it's configured per tool, so Codex needs separate setup, and DeepSeek Harness isn't yet supported. On model choice, domestic models are deemed sufficient. The article notes that bypassing login is a third-party workaround whose stability and compliance may change with official policies.

Before You Install: Decide Which Agent to Use

Instructor Lian starts by throwing cold water: there's no absolute best among coding agents. He's used Claude Code, Codex, Cursor, and Trae, and which one to pick mainly comes down to company constraints and personal preference. If your company has no hard requirements, he personally leans toward Claude Code or Codex.

Here's a notable industry observation: many companies have started setting quotas for the proportion of AI-generated code—50% at the low end, up to 90% or even 100% at the high end. In other words, these tools are shifting from "novelty toys" to "production infrastructure," and being unable to install or use them directly impacts day-to-day delivery.

Installation: Skip PowerShell and CMD, Use npm

The official docs offer several installation methods, with corresponding PowerShell and CMD commands on Windows. Instructor Lian's hands-on conclusion: under domestic network conditions, these two approaches have inconsistent success rates, and they fail easily when carrier restrictions tighten.

Through these two methods

He recommends the npm installation method mentioned under "Advanced Setup" on the official site, with two foolproof prerequisites:

  • Node.js version 22 or higher (24 is the latest), download the installer from the official site and click Next all the way through
  • Git, likewise just click Next all the way through

After installing Node and Git and configuring your VPN/proxy environment, run the npm install command. Instructor Lian says he's installed it this way for many colleagues at his company without a single failure and without ever getting banned. After installation, verify with claude --version; if the version number prints normally, you're good to go.

One practical tip along the way: VPN tools have strict risk controls, so buying a one-year membership isn't advisable—better to pay monthly at a higher rate in exchange for stability.

npm is the package manager bundled with Node.js. When Claude Code is distributed via npm, the installation process downloads the package from the npm registry and extracts it to the global directory, then generates the command-line entry point. Compared to PowerShell scripts or CMD batch files, npm uses the standard HTTPS package download channel, which is less affected by carrier interference with specific script domains, making success rates more stable under domestic networks. Node.js 22 is the minimum runtime for Claude Code because certain modern JavaScript features it depends on are only stably supported in that version; Git is needed by some installation scripts and for subsequent version management. After installation, running claude --version actually invokes the global command entry point and prints the built-in version number; normal output means both PATH and the package itself are fine.

First Launch: Three Choices and One Pitfall

On first run of claude, three interactions appear in sequence: whether to trust the current folder, choosing an UI theme, and choosing a login method. The first two are up to you; the third is the real watershed.

It might ask you

Instructor Lian explicitly advises against the official account login method—he's been banned multiple times himself. He's also tried configuring environment variables with an API Key, which carries the same ban risk. His exact words: "I tried that method once before, and it got banned too."

ccswitch: The Core Tool for Skipping Login

The solution is ccswitch, an open-source project originally hosted on GitHub that's now also available as a website. Download the Windows msi installer from the Release page and double-click to install.

It will then

Once opened, the interface is a configuration manager, with a plus sign in the top-left corner for adding providers. Select your target provider (e.g., DeepSeekAd, Zhipu), enter the corresponding API Key, and save. Common model providers are basically all in the list; if yours isn't there, you can use "Custom Configuration" and enter the relay station's API Key and endpoint URL—that works too.

After configuration is complete, re-run claude and the login step is bypassed entirely—no account means nothing to ban. Instructor Lian says he's gone months without being banned using this method. Codex users can also use ccswitch, but note that it's configured per tool: providers set up in Claude Code won't automatically appear under Codex, so you'll need to enter them separately.

One exception: DeepSeek Harness doesn't seem to be supported by ccswitch yet, so it must be configured directly.

The "provider API Key + endpoint URL" model that ccswitch relies on essentially leverages Claude Code's support for custom API endpoints. Claude Code allows requests to be pointed at third-party services compatible with the Anthropic API protocol via environment variables (such as ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY). ccswitch's job is to make the configuration of these environment variables graphical and persistent, avoiding manual setup each time. Many domestic model vendors or relay platforms now offer Anthropic-compatible interfaces, so as long as you have the corresponding Key and Base URL, you can make Claude Code think it's communicating with the official service while requests actually go to a third party. That's why "no account means nothing to ban"—bans target official accounts, and this path never touches the official authentication system.

Model Selection: Good Enough Is Good Enough

On models, Instructor Lian's attitude is pragmatic: domestic models are already capable enough for daily work needs, so there's no need to over-pursue foreign models. He also mentions a subjective difference—DeepSeek Harness's cache hit rate seems higher than some coding agents, though this is personal experience without quantitative data to back it up.

Buying that one-year membership

The course later covers advanced topics like permission modes, MCP, and Skills, but for getting started, nailing down installation and login already helps you avoid most pitfalls beginners encounter.

A caveat: bypassing official login is a third-party workaround, and its stability and compliance will change as official policies evolve. This article merely relays the UP host's hands-on experience and does not constitute a recommendation of any circumvention behavior.

Cache hit rate is an easily overlooked cost metric in coding agent scenarios. Large model APIs typically offer cached pricing for repeated context prefixes (such as system prompts, project descriptions, and conversation history), with cached portions priced far below fresh input. Coding agents carry large amounts of fixed context each round, so the higher the cache hit rate, the lower the actual cost per call and often the faster the response. However, caching strategies are implemented by service providers and vary widely across platforms, making them hard for users to observe directly—you can only judge indirectly through bills and subjective experience. So claims like "DeepSeek Harness has a higher cache hit rate" are better treated as selection references rather than hard conclusions.

#Claude Code#ccswitch#npm installation#bypass login#anti-ban guide#Node.js
Share:

Related articles