系统之家提供 Windows 系统、Ghost 系统、驱动与常用软件的安全下载及安装教程。纯净系统下载 官方纯净版下载 Windows纯净版ISO下载 原版系统下载站点 微软官方镜像下载地址 MSDN我告诉你 纯净系统之家 系统天地纯净版 无捆绑系统下载站 不捆绑任何软件的系统 纯净版Win10下载 纯净版Win11下载 纯净版Win7下载 老毛桃纯净版 大白菜纯净版 装机员纯净系统 电脑公司纯净版 深度技术纯净版 雨林木风纯净版 番茄花园纯净版 萝卜家园纯净版 专注于Win10纯净版 系统总裁纯净版 微PE纯净系统安装 纯净系统镜像网盘下载 123云盘系统下载 百度网盘纯净系统 后台管理
📢 欢迎访问系统之家!所有资源均经过安全检测。

How I Got Claude Code Working in China

发布时间:2026-09-15 | 浏览:1
📥 下载地址(文章开头)
装机神器,安装一切系统。纯净版原版应有尽有!
Instantly share code, notes, and snippets. Star 42 ( 42 ) You must be signed in to star a gist Fork 2 ( 2 ) You must be signed in to fork a gist Embed Select an option Embed Embed this gist in your website. Share Copy sharable link for this gist. Clone via HTTPS Clone using the web URL. No results found Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/docularxu/aa321d6bc4cfe3abde3c098ee42f9908.js"></script> Embed Embed this gist in your website. Share Copy sharable link for this gist. Clone via HTTPS Clone using the web URL. No results found Save docularxu/aa321d6bc4cfe3abde3c098ee42f9908 to your computer and use it in GitHub Desktop. Embed Embed this gist in your website. Share Copy sharable link for this gist. Clone via HTTPS Clone using the web URL. No results found February 12, 2026 If you're a developer in China trying to use Claude Code, you've probably hit the 403 wall. This guide covers how to get it working in three scenarios: macOS Terminal (shell) - using claude CLI directly in your terminal VS Code Terminal - using claude CLI inside VS Code's integrated terminal VS Code Claude Code Extension - using the Claude Code chat panel (installed as a VS Code extension) All three scenarios share the same root cause and solution, but each has its own gotchas. You'll see one of these: I spent a morning fighting this. Here's everything I learned so you don't have to. Anthropic blocks API access from Chinese IPs. This affects everything — OAuth login, API calls, the CLI, and VS Code extensions. Even with a paid Claude Max subscription, you'll get 403'd if your traffic originates from China. If you see HTTP/2 403 — you're blocked. If you see a timeout — DNS or firewall issue. What Doesn't Work ❌ Just logging in harder The auth code exchange succeeds (you get a code from the browser), but the roles endpoint returns 403. Re-running /login , clearing credentials, switching browsers — none of it helps. The block is IP-based, not account-based. ❌ VS Code http.proxy setting alone Adding this to VS Code settings: Did not fix the Claude extension for me. The extension may not respect VS Code's proxy settings. ❌ Launching VS Code from Dock/Finder macOS GUI apps launched from the Dock or Finder do not inherit shell environment variables. So even if you have HTTPS_PROXY set in your ~/.zshrc , VS Code won't see it when launched the normal way. ✅ Step 1: Set Up a Proxy I use Clash with a proxy server outside China. Any VPN/proxy tool works (V2Ray, Shadowsocks, etc.) - you just need an HTTP proxy endpoint. You need to know your proxy's HTTP port number . Where to find it: Clash : Settings → HTTP Port (default 7890 ) V2Ray : check your config file's inbounds section for the HTTP proxy port
📥 下载地址(文章中间)
装机神器,安装一切系统。纯净版原版应有尽有!
Shadowsocks : usually 1080 (SOCKS) or check your client's HTTP proxy setting My Clash runs locally on port 7890 (yours may differ - use your own port throughout this guide). Verify it works: You should see HTTP/1.1 200 Connection established followed by a non-403 response (404 is fine — it means you reached Anthropic's servers). ✅ Step 2: Set HTTPS_PROXY in Your Shell ✅ Scenario 1: macOS Terminal (Claude CLI) With HTTPS_PROXY set, login works directly: The OAuth flow completes successfully - browser opens, you get the auth code, paste it back, and the roles endpoint no longer 403s because your traffic is routed through the proxy. If you had a previous broken login, clear the state first: After login, claude works normally in any terminal session (as long as HTTPS_PROXY is set). ✅ Scenario 2: VS Code Terminal If you launch VS Code from the terminal , its integrated terminal inherits your shell's HTTPS_PROXY . So claude CLI works inside VS Code's terminal too. The key: you must launch VS Code from the terminal, not from Dock/Finder (see "What Doesn't Work" above). On macOS, if code is mapped to another editor (mine was mapped to Cursor), use: You can make an alias for convenience: ✅ Scenario 3: VS Code Claude Code Extension The Claude Code extension (the chat panel inside VS Code) also needs HTTPS_PROXY to reach Anthropic's servers. The same rule applies: launch VS Code from the terminal so the extension process inherits the proxy variable. Once VS Code is launched this way, open the Claude Code chat panel - it should connect without 403. ✅ Bonus: VS Code Remote SSH If you SSH into a remote machine (e.g., a Linux VM) from VS Code, the Claude extension runs on the remote side. So the remote machine also needs HTTPS_PROXY set. My setup: MacBook Pro running an Ubuntu VM via Parallels. The Mac's bridge interface is 192.168.2.1 , so on the VM: Make sure your proxy allows LAN connections (in Clash, enable Allow LAN ). Then launch VS Code from the terminal on the Mac side, open a Remote SSH session, and the Claude extension works on the remote machine too. The fundamental issue is simple: Anthropic blocks Chinese IPs, and macOS GUI apps don't inherit shell env vars. Once you understand these two facts, everything falls into place. What It Looks Like When Everything Works VS Code with Claude Code extension running - the chat panel on the right, claude CLI in the terminal, and a Remote SSH session to a Linux VM. All working through the proxy. Setup: MacBook Pro + Ubuntu VM (Parallels) in China, Claude Max subscription, Clash proxy, Claude Code v2.1.39 dvdcodez commented Apr 7, 2026 • edited Loading Uh oh! There was an error while loading. Please reload this page . There was an error while loading. Please reload this page . There was an error while loading. Please reload this page . Hey i got it to work in similar way for my chinese home wifi, but .. now im struggling getting it to work in a hotel using captive wifi, or my sim card from abroad using hotspot to laptop. Would / could be cool with a solution for that too. I started looking into it a couple of hours ago as i checked in to the hotel here in beijing, yet to find a way. -- edit -- ok so with astrill vpn i managed to get it working by using export no_proxy='*' claude in terminal. ckoehncke commented Apr 16, 2026 Thanks for clear post. I got Claude to translate this for Windows 11 and got testing with VS Code extension from Powershell: $env:HTTPS_PROXY = " http://127.0.0.1:7890 " code . I'm using Clash VPN client port 7890 which is default Noman21-wq commented Jun 16, 2026 It works thanks Mohamzaazam commented Aug 22, 2026 is it still working??
📥 下载地址(文章结尾)
装机神器,安装一切系统。纯净版原版应有尽有!