A Claude Code proxy setup is mostly a question of environment variables. Claude Code, Anthropic's command-line coding tool, respects the standard proxy variables that many developer tools use, so on a company network that sends traffic through a proxy, a couple of lines are usually enough. This page covers those variables, custom certificates for networks that inspect TLS, how to confirm the settings took effect, and the limits on what a proxy should be used for. FreshProxies is not affiliated with Anthropic, and the details below follow Anthropic's network configuration documentation for Claude Code at the time of writing.
When a Claude Code proxy setting makes sense
- Company networks. Many organizations route all outbound traffic through an HTTP proxy, and tools that ignore it simply can't connect.
- Testing and debugging. Developers sometimes route traffic through a local debugging proxy to inspect what their own tools send.
- Tools that Claude Code runs. When Claude Code runs commands for you, such as curl, a Python script or a package manager, those programs make their own network requests, and some of them may need a different proxy.
Setting the environment variables
Set the variables in your shell before you start Claude Code. It reads them once at startup, so restart it after any change.
# Send Claude Code's traffic through your company's HTTP proxy
export HTTPS_PROXY=http://HOST:PORT
# If the proxy needs a login, put it in the URL
export HTTPS_PROXY=http://USERNAME:PASSWORD@HOST:PORT
# Hosts that should skip the proxy (comma- or space-separated)
export NO_PROXY="localhost,127.0.0.1,.internal.example.com"
claude
In Windows PowerShell, the same settings look like this:
$env:HTTPS_PROXY = "http://HOST:PORT"
$env:NO_PROXY = "localhost,127.0.0.1"
claude
A few details from Anthropic's documentation:
HTTPS_PROXYis the recommended variable.HTTP_PROXYis used when no HTTPS proxy is set.- Lowercase variants such as
https_proxyalso work. NO_PROXYaccepts comma- or space-separated entries, andNO_PROXY="*"sends everything direct.- Write the proxy as a complete URL that starts with
http://, not justHOST:PORT. - Don't hard-code passwords in scripts you share. Use environment variables or a credential store.
You can also keep the variables in Claude Code's settings file instead of your shell profile. Anthropic documents an env block in ~/.claude/settings.json for this:
{
"env": {
"HTTPS_PROXY": "http://HOST:PORT",
"NO_PROXY": "localhost,127.0.0.1"
}
}
The settings file is the more dependable option if you run background sessions, because those don't always inherit the variables from the terminal you happen to be in.
Company networks that inspect TLS
Some corporate proxies decrypt and re-encrypt HTTPS traffic to inspect it, using the company's own certificate authority. Tools that don't trust that authority fail with certificate errors.
By default, Claude Code trusts its bundled certificates and, with the native installer or a recent Node version, your operating system's certificate store as well. A corporate root certificate installed on the system therefore often works without extra steps. If it doesn't, point Claude Code at the certificate file directly:
export NODE_EXTRA_CA_CERTS=/path/to/company-ca.pem
For networks that require client certificates (mutual TLS), Anthropic documents the CLAUDE_CODE_CLIENT_CERT and CLAUDE_CODE_CLIENT_KEY variables. Proxies that need NTLM or Kerberos authentication are not supported directly, and Anthropic suggests an LLM gateway that supports your authentication method instead.
What isn't supported
- SOCKS proxies. Claude Code does not support them, so a SOCKS5 proxy line won't work. Use an HTTP or HTTPS proxy URL.
- NTLM and Kerberos proxy authentication, as noted above.
If you test with a commercial proxy, use its HTTP line. FreshProxies proxies offer HTTP(S) as well as SOCKS5, and the HTTP and SOCKS5 guide explains the difference.
Check that the proxy is being used
When Claude Code can't parse a proxy URL from your shell or settings file, it stops at launch with an error that names the variable to fix. To confirm a working setup:
- Run
/statusin an interactive session. The Proxy row shows the active proxy URL and marks a value it can't parse as invalid. - Start Claude Code with
claude --debugand read the debug log it writes under~/.claude/debug/. The log records whether extra CA certificates and client certificates loaded.
If requests still fail, check that your proxy and firewall allow the hosts Claude Code needs. Anthropic's network configuration page lists them all. The core ones are api.anthropic.com for API requests, and claude.ai and platform.claude.com for signing in.
Common problems
- Connection errors on the first run. The proxy variable isn't set in the shell that started Claude Code, or the proxy blocks one of the required hosts.
- A 407 response from the proxy. The username or password is wrong. If the password contains characters such as
@,:or#, percent-encode them in the URL, for example@as%40. - Certificate errors. The network inspects TLS. See the certificate section above.
- It works in your terminal but not in background sessions. Move the variables into the
envblock of your settings file. - A change has no effect. Claude Code reads the variables at startup, so restart the session.
What a proxy must not be used for
Anthropic offers its services only in supported countries and regions, and its terms apply wherever you connect from. Using a proxy to appear to be somewhere you are not, to get around those rules, or to get around account restrictions breaks Anthropic's terms. It also breaks our acceptable use policy, and it is not something we will help with. A proxy is for reaching services you are already allowed to use, through the network you are on.
Using FreshProxies proxies with the tools Claude Code runs
The lawful case where a commercial proxy fits most naturally is the work itself. If Claude Code helps you build a scraper for public data or a price monitor, the proxy belongs in that tool, not in Claude Code's own connection to Anthropic. Pass it to the specific command or library:
# Only this request goes through the proxy
curl -x http://USERNAME:PASSWORD@HOST:PORT https://example.com
That keeps Claude Code's own connection on your normal network while the script uses residential, ISP or datacenter IPs as needed. Our curl guide and Python guide show the setup for each tool, and the AI data collection page covers collecting public data responsibly.