How to use Nyxon proxies in curl, Python and Node.js (copy-paste examples)
Working code for the four clients people actually use: curl, Python requests and httpx, Node fetch and axios, with rotation, sticky sessions, SOCKS5 and the two mistakes that break each one.

Nyxon's gateway speaks plain HTTP and SOCKS5 proxy protocols, so anything that can use a proxy can use it. The examples below are copied from working setups. Replace USERNAME, PASSWORD, HOST and PORT with the values on your plan page; the residential gateway examples use geo.gw.nyxon.sh:8080, the budget pool uses budget.gw.nyxon.sh on ports 6969 (HTTP) and 9696 (SOCKS5).
The credential format
Everything hangs off one string:
USERNAME-country-us-session-abc123:[email protected]:8080The part before the colon is the username plus optional targeting tokens (-country-, -state-, -city-, -session-, -time-). Leave the session token off to rotate per request. The sessions guide covers the syntax; the Generate page builds it for you.
curl
Rotating, HTTP:
curl -x http://USERNAME-country-us:[email protected]:8080 https://api.ipify.orgSticky for ten minutes:
curl -x http://USERNAME-country-us-session-abc123-time-600:[email protected]:8080 https://api.ipify.orgSOCKS5, with DNS resolved on the exit side (note the h):
curl -x socks5h://USERNAME-country-de:[email protected]:9696 https://api.ipify.orgTwo curl mistakes: a password with shell-special characters (&, !, $) breaks unless the whole -x value is single-quoted, and curl's default user agent gets blocked by protected sites, so add -A with a real browser string when testing a target.
Python with requests
import requests
PROXY = "http://USERNAME-country-us:[email protected]:8080"
proxies = {"http": PROXY, "https": PROXY}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0 Safari/537.36",
"Accept-Language": "en-US,en;q=0.9",
}
r = requests.get("https://api.ipify.org?format=json", proxies=proxies, headers=headers, timeout=20)
print(r.status_code, r.json())Sticky sessions per worker, the pattern that survives logins:
import requests, secrets
def make_session(country="us"):
sid = secrets.token_hex(4)
proxy = f"http://USERNAME-country-{country}-session-{sid}-time-1500:[email protected]:8080"
s = requests.Session()
s.proxies = {"http": proxy, "https": proxy}
s.headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0 Safari/537.36"
return s
s = make_session()
s.post("https://target.example/login", data={"user": "...", "pass": "..."})
page = s.get("https://target.example/account") # same exit, same cookiesSOCKS5 needs one extra package (pip install requests[socks]), then use socks5h://USERNAME:[email protected]:9696 as the proxy URL.
Two requests mistakes: passing the proxy only under "http" and wondering why HTTPS sites ignore it, and using one Session across threads, which mixes cookies and, with a session token, funnels every thread through one IP.
Python with httpx (async)
import asyncio, httpx
PROXY = "http://USERNAME-country-gb:[email protected]:8080"
async def fetch(client, url):
r = await client.get(url, timeout=20)
return r.status_code, r.text[:80]
async def main():
async with httpx.AsyncClient(proxy=PROXY, headers={"User-Agent": "Mozilla/5.0 ..."}) as client:
results = await asyncio.gather(*(fetch(client, "https://api.ipify.org") for _ in range(5)))
for status, body in results:
print(status, body)
asyncio.run(main())With no session token each of those five requests can leave through a different exit. With -session- in the username they share one.
Node.js with fetch (undici)
Node 18+ ships fetch, and proxying it goes through undici's dispatcher:
import { ProxyAgent } from "undici";
const agent = new ProxyAgent("http://USERNAME-country-us:[email protected]:8080");
const res = await fetch("https://api.ipify.org?format=json", {
dispatcher: agent,
headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0 Safari/537.36" },
});
console.log(res.status, await res.json());Install undici with npm i undici if your Node version does not expose ProxyAgent globally.
Node.js with axios
import axios from "axios";
import { HttpsProxyAgent } from "https-proxy-agent";
const agent = new HttpsProxyAgent("http://USERNAME-country-us-session-abc123:[email protected]:8080");
const { status, data } = await axios.get("https://api.ipify.org?format=json", {
httpsAgent: agent,
httpAgent: agent,
proxy: false, // important: disable axios's own proxy handling
headers: { "User-Agent": "Mozilla/5.0 ..." },
});
console.log(status, data);The proxy: false line is the axios mistake everyone makes once: without it axios tries to apply its own proxy logic on top of the agent and requests fail in confusing ways. For SOCKS5 use socks-proxy-agent with a socks5h:// URL.
Browsers and automation frameworks
Playwright, Puppeteer and Selenium all accept a proxy server and credentials at launch. The one thing to know is that browser proxy settings apply per browser context, so for sticky sessions launch one context per session id and keep its cookies with it. Anti-detect browsers take the same host:port plus username and password in their proxy settings.
Checking it worked
Whatever the client, the first request should go to an IP echo service and the answer must not be your own address. The 60-second test walks through exit location, stickiness and latency, and the proxy tester in the dashboard does it without code. If a target then blocks you while the echo service works, the cause is almost always headers, TLS or behaviour rather than the IP, and the ten mistakes lists the usual suspects.