Claude Code Proxies: How to Set Up and Use an AI Coding Agent with a Proxy

A proxy lets the claude code CLI send its requests through a controlled exit point instead of your raw connection. This matters for corporate compliance, stable automation, and consistent regional performance. This guide explains which proxy types fit, how to configure them step by step with screenshots, and how to verify the result. It also covers a quick browser setup for the claude.ai web app, so both the terminal agent and the browser can share the same controlled egress.
What a claude code proxy is – and when you need one
The phrase has two meanings, and confusing them causes most setup mistakes. The first is a network proxy: a server between the CLI and the internet that forwards requests and presents a single, controlled exit point. The second is a software gateway that re-routes model traffic to an alternative backend. Both are legitimate and solve different problems.
Proxys.io provides the first type: dedicated and shared IPv4, IPv6, residential, and dynamic endpoints over HTTPS, HTTP, and SOCKS, across many regions. For controlled, stable egress from your automation hosts, it is a solid starting point worth trying.
How claude code routes traffic (and where a proxy fits)
The CLI runs on Node.js and sends each request to the model API over HTTPS. A network proxy intercepts those calls and forwards them upstream. The model still runs on Anthropic’s infrastructure; only the route changes. Your egress IP, monitoring, and certificate handling move to the proxy, which is exactly what regulated environments require. In practice the CLI needs to reach the model API and a small number of telemetry hosts, and all of that traffic flows through the same endpoint.
Legitimate use cases – and when you don’t need a proxy
Common reasons include forcing all agent traffic through one auditable egress, meeting corporate network policy, and getting stable latency from automation hosts. A proxy also gives a consistent source IP for legitimate automation such as web scraping, market research, ad verification, and SEO monitoring. If you run the CLI locally with no compliance need, you do not need one.
Proxy types and protocols for claude code
The right choice depends on your workload: how strict the destinations are, whether sessions must stay on one IP, and which protocol your path supports.
Datacenter, residential, and mobile – which fits which workload
Datacenter IPs are fast and cheap, ideal for a single session or internal CI jobs, though they carry lower reputation on strict third-party sites. Residential IPs balance trust and cost for automation that touches demanding sites. Mobile IPs have the highest trust and the highest price, reserved for the most sensitive workloads.
Static / dedicated vs rotating – why CLI sessions usually want a sticky IP
For interactive CLI sessions, use a static, dedicated IP. A stable exit point avoids re-authentication and dropped sessions. Use rotating IPs only for automation that issues many requests across destinations, where varying the source address is the point. Mixing the two is a frequent cause of instability.
HTTP(S) vs SOCKS5 and IPv4 vs IPv6 – Node.js support and compatibility
claude code reads HTTP(S) proxy settings natively, so an HTTPS endpoint is the simplest and most reliable path. It has no native SOCKS5 support; to use SOCKS, run a local converter and point the CLI at it. IPv4 has the broadest compatibility, while IPv6 and dynamic pools are cheaper for high-volume jobs when the whole path supports them. When in doubt, an authenticated HTTPS IPv4 endpoint is the safest default for the CLI.
Comparison table: proxy types for claude code
Proxy Type | Best For | Pros | Cons | Price / Availability |
|---|---|---|---|---|
Single CLI session, internal CI jobs | Fast, low latency, very affordable | Lower reputation on strict sites | Lowest cost; abundant | |
Automation on strict external sites | Strong reputation, balanced cost | Pricier than datacenter | Mid-range; good supply | |
High-reputation, demanding work | Highest trust, hard to throttle | Most expensive, often slower | Premium; limited supply | |
IPv6 / Dynamic | High-volume, cost-sensitive jobs | Cheapest per address, large pools | Path must support IPv6 | Very low cost; broad |
How to choose the right proxy (Quick Checklist)
- Single interactive session: a static datacenter IP near you is fastest and cheapest.
- Automation on strict sites: residential, or mobile for the most demanding targets.
- High request volume on a budget: IPv6 or dynamic pools, if your path supports them.
- Compliance or audit need: a dedicated IP that gives one fixed, loggable egress.
- On a tight budget: start with one shared or datacenter IP, and trial it before scaling.
- Always match the proxy region to the location your workload expects.
How to set up a proxy for claude code (step-by-step)
Setup is mostly a matter of environment variables. The CLI inherits them from the shell or reads them from its settings file. The sequence below is reproducible on every supported platform.
Step 1: Confirm Node.js and the claude code CLI
- Check Node.js with node - v (version 18 or newer is recommended).
- Install or update the agent globally so you are on a current build.
- Verify with claude – version before changing any network settings.

Step 2: Get your proxy details from proxys.io
- Copy the host, port, login, and password from your proxys.io dashboard.
- Pick a location close to your team for the lowest added latency.
- If your plan uses IP whitelisting, add your current address instead of embedding credentials.

Step 3: Set HTTPS_PROXY and HTTP_PROXY
- Export HTTPS_PROXY with your endpoint, and HTTP_PROXY only if a plaintext channel is needed.
- Define the variables before launching, because the CLI reads them once at startup.
- Start the agent in the same shell so it inherits the values.

Limitation: Recent CLI versions route all traffic through the configured endpoint and have not reliably honored NO_PROXY. Verify current behavior before relying on selective routing.
Step 4: Or scope the configuration to the project
- Place the values in the env block of the settings file instead of exporting globally.
- This keeps the setup scoped to the project and leaves other tools untouched.
- Commit a template without secrets, and keep real credentials out of version control.

Step 5: Authenticated and SOCKS5 endpoints
- For authenticated endpoints, embed the user and password in the URL, or read them from a secret manager.
- SOCKS5 is not native: run a local HTTP-to-SOCKS forwarder and point HTTPS_PROXY at the local listener.

Step 6: Corporate proxy and custom CA certificates
- Set NODE_EXTRA_CA_CERTS, and where needed SSL_CERT_FILE, to the certificate bundle your security team provides.
- For NTLM or Kerberos, place a gateway that handles the enterprise scheme between the CLI and the network.

Pitfall: Child processes, including MCP servers, may not inherit these values. If a tool call fails with a certificate error while the main session works, set them in that server’s environment.
Per-OS notes (macOS / Linux / Windows)
- macOS and Linux: export the variables in your shell profile so each new session inherits them.
- Windows: set them in the system environment settings or your terminal, then restart the terminal.

Using a proxy in CI/CD and containers
Automation magnifies small mistakes. The same variables apply in pipelines and containers, but credential handling and inheritance need extra discipline to keep builds reproducible and secure.
Docker and CI pipelines (GitHub Actions, GitLab CI)
- A container does not inherit the host shell, so pass the variables at runtime with the -e flag.
- Bake the certificate bundle into the image if needed, but never the credentials.

- In CI, define the endpoint as a masked secret and inject it as an environment variable for the job.
- Every runner then reaches the API through the same controlled egress.

Keeping credentials out of logs
Treat the endpoint URL as a secret whenever it contains a username and password. Store it in the platform secret store, mask it in output, and prefer IP whitelisting where the provider supports it, so the value never reaches a log file.
For CI/CD and container workloads, proxys.io supports IP whitelisting and username-and-password authentication across its HTTPS, HTTP, and SOCKS plans. For scaling claude code automation across many runners, it is a practical, cost-effective backend to standardize on.
How to test your proxy with claude code
Verify exit IP and check for DNS leaks
- Enable routing, then query an IP-reporting service and confirm it shows the exit IP, not your origin address.
- If your own address still appears, a variable is missing or the shell did not inherit it; re-export it and relaunch.
- Run a DNS leak check and confirm every resolver belongs to the configured path, not your local provider.

Check latency, stability, and that claude code actually uses the proxy
- Compare response times with and without routing; a well-placed datacenter endpoint adds only tens of milliseconds for a smooth claude code cli experience.
- Run several requests in a row to check stability and watch for dropped sessions.
- Confirm usage by watching traffic at the proxy server, which is definitive proof rather than assuming the settings took effect.
Common issues and how to fix them
Proxy variables ignored / TLS / authentication errors
If routing seems ignored, the shell likely did not inherit the variables; export them and relaunch in the same session. TLS errors usually mean the inspecting authority is not trusted, so set NODE_EXTRA_CA_CERTS to the right bundle. Authentication failures point to wrong credentials or an address that is not whitelisted. When only some calls fail, suspect a child process that did not inherit the same settings.
Timeouts, dropped sessions, wrong region – rotation vs sticky IP
Frequent timeouts or mid-session drops often come from rotating IPs on interactive work; switch to a static, sticky address. A wrong region usually means the endpoint location does not match what the workload expects, so pick a proxy in the right country. If a single IP starts getting throttled, a fresh dedicated address from the same region usually restores normal behavior.
Best practices and responsible use
Use a dedicated IP for interactive sessions and reserve rotation for high-volume automation. Keep credentials in a secret manager, never in committed files or logs. Match the proxy region to your workload, and prefer the cheapest type that meets the reputation requirement. Monitor your egress so you can spot a failing or throttled endpoint early, and give each automation only the access it needs. Use proxies only for legitimate work such as compliance, performance testing, and authorized data collection, and respect the terms of the services you reach.
Bonus: quick browser setup for claude.ai (ProxyControl)
If you also use claude.ai in the browser, the ProxyControl extension from proxys.io routes it without touching system-wide network settings, which is ideal for quick testing and a separate, controlled exit point for the web app.
Step 1: Install ProxyControl
- Open your browser’s extension store, find ProxyControl by proxys.io, and add it.
- Pin the icon so the on and off toggle stays one click away.

Step 2: Add your proxy profile
- Enter the host, port, login, and password from your proxys.io dashboard, or import many endpoints with your API key.
- Select the protocol your plan provides; HTTP(S) endpoints work directly.

Tip: If your plan uses IP whitelisting, enable the IP-based option and whitelist your current address in the proxys.io dashboard.
Step 3: Route only claude.ai, keep other sites direct
- Open Settings, find Whitelist of sites, and add claude.ai and *.claude.ai.
- Save the whitelist. Only listed sites are routed; everything else stays on a direct connection, keeping browsing fast.

Step 4: Turn routing on and confirm it works
- Select the endpoint in the list, set it as the current proxy, and toggle ProxyControl on.
- Open claude.ai to confirm it loads, then check an IP site to confirm the address changed.

SOCKS5 note: The extension handles HTTP(S) directly. For SOCKS5 with login, pair it with a local helper, the same forwarder pattern used for the CLI.
ProxyControl is free with any proxys.io plan, and a static foreign IPv4 starts from about 1.47 USD per month. It is a quick, low-cost way to give claude.ai a stable exit point worth setting up alongside your CLI configuration.
FAQ
Free trial / free proxy, static vs rotating, and speed
Many providers, proxys.io included, let you trial an endpoint before committing; check the current terms. Be wary of fully free public proxies, which tend to be slow, unstable, and shared with unknown users, a poor fit for steady CLI work. For the CLI, a static IP is almost always better than rotation, which suits high-volume automation. Speed depends mostly on distance, so a nearby datacenter endpoint keeps latency low.
Multiple machines, and why it works sometimes but not always
You can reuse one endpoint across machines, but each shell still needs the variables set. Setup that works in one terminal but not another usually means the second session did not inherit them, or a child process did not receive the certificate settings. Set them explicitly where needed.