一键重装系统工具 | U盘启动盘制作工具 | 误删文件恢复软件 | 硬盘数据抢救专家 | 电脑蓝屏修复助手 | C盘空间清理神器 | 电脑驱动离线安装工具 | 微信聊天记录恢复工具 | 照片误格式化恢复 | 电脑密码破解清除工具 | 系统崩溃紧急救援盘 | 电脑加速优化大师 | 电脑开不了机怎么重装系统 | 回收站清空了怎么恢复 | 硬盘分区丢失数据恢复 | 电脑卡顿重装系统有用吗 | U盘插入提示格式化数据恢复 | 电脑中毒文件被隐藏恢复 | 忘记电脑开机密码怎么办 | 新硬盘分区对齐工具 | 旧电脑装Win10流畅工具 | SD卡照片删除恢复免费版 | 移动硬盘打不开提示损坏修复 | 电脑无故重启系统修复工具 | 电脑小白一键重装神器 | 程序员电脑环境配置助手 | 设计师电脑字体/素材恢复工具 | 网吧网管系统维护工具箱 | 财务人员电脑发票备份恢复 | 学生党免费电脑系统安装包 | 电脑维修师傅必备工具盘 | 游戏玩家电脑性能优化助手 | 办公白领误删文档恢复软件 | 自媒体视频素材恢复工具 | 网课录制视频损坏修复工具 | 最好的U盘PE系统排名 | 数据恢复软件哪个最强 | 免费电脑助手与收费版区别 | 国产装机工具哪款无广告 | 离线版驱动助手推荐 | 轻量级电脑优化工具对比 | 支持NVMe驱动的PE工具 | 带网络功能的应急启动盘 | 2026最新版万能装机工具 | 支持Win11 24H2的PE工具 | 最新免激活系统重装工具 | 2026数据恢复软件破解版合集 | 纯净无捆绑装机助手V3.0 | 支持苹果M芯片的电脑助手 | 秋季更新版系统维护工具箱 | 电脑系统崩了怎么用U盘把重要资料拷贝出来 | 重装系统前哪些文件夹必须备份 | 固态硬盘误格式化还能恢复数据吗 | 如何制作一个既带PE又能存数据的双分区U盘 | 电脑总是弹窗广告用什么助手彻底拦截 后台管理
📢 欢迎访问系统之家!所有资源均经过安全检测。

How I Got Claude Code Working in China

发布时间:2026-09-07 | 浏览:2
📥 下载地址(文章开头)
装机神器,可以安装一切系统。
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??
📥 下载地址(文章结尾)
装机神器,可以安装一切系统。