@liulangtutu: https://x.com/liulangtutu/status/2066683148998439352
Summary
Introduces detailed steps for making Codex and Claude Code smoothly use a proxy by setting environment variables and startup parameters without enabling system proxy or TUN mode.
View Cached Full Text
Cached at: 06/16/26, 11:53 AM
Two-Step Configuration: Use Codex and Claude Code Smoothly Without System Proxy or TUN Mode
While browsing X, I noticed many people using Codex and Claude Code with TUN mode or system proxy enabled. This routes all software through the proxy, but brings two issues.
First, most domestic software accessing the internet via a proxy will be severely slowed down, resulting in a poor experience. Second, our proxy services usually have traffic limits, e.g., 100GB per month. If all apps go through the proxy, it might not hold up.
Although you can use Clash Verge rules to specify which software bypasses the proxy, it’s still inconvenient when there are many applications.
In reality, only two or three pieces of software actually need the proxy. Below I’ll share my approach: no system proxy, no TUN mode. I’ve been using this for nearly six months without any issues with Codex and Claude Code.
The following example is based on macOS, but it’s similar on Windows – you can ask AI to adapt the commands for Windows.
Assume your Clash Verge port is 7890 (use your own port number).
Step 1: Set Environment Variables
On Mac, edit the ~/.zshrc file and add the Clash Verge proxy port.
Here’s how:
Open the file:
touch ~/.zshrc && open -e ~/.zshrc
Paste the environment variables:
export HTTP_PROXY="http://127.0.0.1:7890"
export HTTPS_PROXY="http://127.0.0.1:7890"
export ALL_PROXY="socks5://127.0.0.1:7890"
export NO_PROXY="localhost,127.0.0.1,::1"
After pasting, press Command + S to save, then close the window.
Back in the terminal, run source ~/.zshrc to make the environment variables take effect.
To verify success, run:
echo $HTTPS_PROXY # Should output http://127.0.0.1:7890
curl -I https://www.google.com # Should return 200/3xx if proxy works
Once this step is done, all programs launched from the command line will connect through your Clash Verge port. At this point, you can freely use the Claude Code CLI in the terminal – Claude Code does not require Step 2.
Step 2: Launch Desktop Apps with Proxy Arguments
The desktop version of Codex is based on Electron/Chromium and can accept proxy parameters at launch. Open it via the terminal with the following command:
open -na "/Applications/Codex.app" --args \
--proxy-server="http://127.0.0.1:7890" \
--proxy-bypass-list="localhost;127.0.0.1;[::1]"
Launched this way, Codex will also use the proxy smoothly.
But obviously, typing this command every time is inconvenient.
You can ask Codex (or any AI) to package this command into an .app launcher, place it in the Applications folder, and then simply open it from Launchpad:
After setting this up, first press Command + Q to completely quit the normally launched Codex, then open it via the launcher.
That’s it.
Bonus
Install the ZeroOmega plugin in your browser and enable the proxy only for specific websites. Other domestic sites will automatically bypass the proxy. This way, you no longer have to worry about speed or traffic when streaming videos in the browser.
You can search online for how to use the ZeroOmega plugin in your browser.
Similar Articles
@anxue201: https://x.com/anxue201/status/2067477109816050119
A detailed configuration guide that teaches users how to connect OpenAI Codex to third-party models like DeepSeek through the open-source proxy tool CC Switch, solving protocol incompatibility issues.
@quant_sheep: I don't use Codex's remote mode at all because it's unstable. I recommend you try Happy Code — it's the best solution for using Codex and Claude Code remotely. Fully open-source (including backend service), end-to-end encrypted, and completely free.
Happy Code is an open-source mobile and web client that enables remote use of Claude Code and Codex with end-to-end encryption, allowing developers to monitor and control AI coding agents from anywhere.
@yupi996: https://x.com/yupi996/status/2064510096516981231
Programmer Yu Pi shares a step-by-step tutorial on how domestic users can smoothly use Claude Code and Codex for AI programming, solving network access issues.
@wangray: Tested and Working: Quick Guide to Configure Codex to Retain ChatGPT Login While Using Third-Party Providers - Even Free Accounts Can Access Relay Stations and Remotely Control Desktop Codex via ChatGPT on Phone
A guide on configuring Codex to retain ChatGPT login while using third-party providers, allowing free accounts to access relay stations and remotely control desktop Codex via phone.
@Xudong07452910: https://x.com/Xudong07452910/status/2057386528859381870
A configuration guide for Claude Code beginners, introducing 8 key environment variables to optimize performance, reduce costs, and improve the experience.