@liulangtutu: https://x.com/liulangtutu/status/2066683148998439352

X AI KOLs Timeline Tools

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.

https://t.co/HAOK9Ibdaj
Original Article
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