Use case

Proxies for Perplexity: The SDKs, the MCP Server and the CLI, Tested Behind a Proxy

How the Perplexity SDKs, MCP server and pplx CLI take a proxy, from the docs and our tests: which examples work, which go direct, and SOCKS5.

HProxy Team··Updated September 27, 2026·7 min read
HProxy.Use case

Free proxies won't hold up here.

Shared datacenter IPs get flagged and dropped fast. When it has to hold, gaming, streaming, accounts, you need mobile and residential IPs that read as a real device, from $0.44/GB, pay as you go.

See plans & pricing→

A Perplexity proxy means one of two things. A gateway or reverse proxy sits in front of the Perplexity API and forwards calls from many apps or keys. Searches such as "perplexity reverse proxy" are after that kind. A network proxy is an exit that your own code or browser sends its traffic through. This page covers the network kind. It rests on the Perplexity docs and terms, and on our tests of the official Python SDK, Node SDK, MCP server and pplx CLI on our server.

Where the proxy goes

Perplexity offers four ways to reach its API from code, and each one takes a proxy in its own way.

Where you use PerplexityWhere the proxy goes
The web app, or CometBrowser, system or ProxySettings policy
Python SDKHTTPS_PROXY, or proxy= in DefaultHttpxClient
Node SDKHTTPS_PROXY with NODE_USE_ENV_PROXY=1
MCP server, run locallyPERPLEXITY_PROXY, as an http:// URL
pplx CLIHTTPS_PROXY or https_proxy

For Comet, admins can set the ProxySettings policy with a fixed server, a PAC file or the system proxy. Perplexity notes that "Leaving the policy unset lets users choose their proxy settings."

The web app and the API from a server

From our server in a data center, www.perplexity.ai answered with a Cloudflare challenge page, "Just a moment...". The API at api.perplexity.ai answered 401 to a call without a key, with no challenge. For code, the API is the route. The Perplexity terms forbid robots and scrapers that access the Services "to monitor, extract, copy or collect information". We give no steps past the challenge.

What we measured

We ran every client on our server against a proxy of our own that wrote down each connection and refused it. A SOCKS5 server of our own did the same for SOCKS URLs. A call that skipped the proxy reached Perplexity and got its 401, since the key was a dummy.

Perplexity clients behind a proxy
Used the proxyWent direct
Python SDK, HTTPS_PROXY✓ yes✕ no
Node SDK, HTTPS_PROXY only✕ no✓ yes
Node SDK, plus NODE_USE_ENV_PROXY=1✓ yes✕ no
Node SDK, httpAgent from the docs✕ no✓ yes
Node SDK, README dispatcher (call failed)✕ no✕ no
Node SDK, dispatcher and undici fetch✓ yes✕ no
MCP server, PERPLEXITY_PROXY=http://✓ yes✕ no
MCP server, with NO_PROXY set✓ yes✕ no
pplx CLI, HTTPS_PROXY✓ yes✕ no
pplx CLI, with NO_PROXY set✕ no✓ yes
Source: HProxy lab on our server, 27 September 2026: perplexityai 0.43.6, @perplexity-ai/perplexity_ai 0.38.6 on Node 24.21.0, @perplexity-ai/mcp-server 1.3.0, pplx 0.2.3, a proxy and a SOCKS5 server of our own that write down every connection and refuse it, a dummy key

The Python SDK did what its docs say. It followed HTTPS_PROXY and a proxy set in DefaultHttpxClient, NO_PROXY kept it direct, and a percent-encoded password arrived decoded. Our httpx guide covers the client underneath it.

The Node SDK needs more care. Its fetch ignored HTTPS_PROXY until NODE_USE_ENV_PROXY=1 was set, a switch added in Node 24.0.0 and 22.21.0. The docs site shows an httpAgent with HttpsProxyAgent, and in our test the SDK ignored it and called Perplexity directly. The SDK README shows a dispatcher from undici instead. On its own, that call failed before it reached our proxy. It worked once the fetch of undici went in as well, the pairing that the undici docs show:

import Perplexity from '@perplexity-ai/perplexity_ai';
import { ProxyAgent, fetch } from 'undici';

const dispatcher = new ProxyAgent('http://USERNAME:PASSWORD@HOST:PORT');
const client = new Perplexity({ fetch, fetchOptions: { dispatcher } });

The MCP server

Perplexity hosts a remote MCP server, and it also ships a local one that agents such as Claude Code and Codex can run. The local server reads PERPLEXITY_PROXY, then HTTPS_PROXY, then HTTP_PROXY, and "If none are set, it connects directly to the internet." The variable belongs in the env block of the server, next to the key:

{
  "mcpServers": {
    "perplexity": {
      "command": "npx",
      "args": ["-y", "@perplexity-ai/mcp-server"],
      "env": {
        "PERPLEXITY_API_KEY": "your_key_here",
        "PERPLEXITY_PROXY": "http://USERNAME:PASSWORD@HOST:PORT"
      }
    }
  }
}

Our test of version 1.3.0 found three things the README does not say. The README asks for URLs that "must include https://". With a plain HTTP proxy, the kind our lines are, an https:// URL made the server open TLS to the proxy, and the call failed. An http:// URL worked. The server also ignored NO_PROXY and the lowercase https_proxy, and it refused a socks5 URL. A percent-encoded password arrived decoded. For the settings of Claude Code itself, see our Claude Code page.

The pplx CLI

The pplx CLI, version 0.2.3, behaved like a classic command line tool. It followed HTTPS_PROXY and its lowercase form, NO_PROXY kept it direct, and a percent-encoded password arrived decoded. It also took SOCKS5. A socks5 URL made it look up the address itself, and socks5h sent the host name for the proxy to resolve.

SOCKS5 lines

The Python SDK takes SOCKS5 after one install, pip install httpx[socks]. Without it, building the client stopped with an error that names the missing socksio package. With it, both socks5 and socks5h URLs sent the Perplexity host name to our SOCKS5 server. The pplx CLI takes SOCKS5 as it is. The MCP server refuses it, and for Node the http form is the safe one: in our Kling tests, Node 24.21.0 sent a SOCKS5 password still percent-encoded.

Answers by country are a setting

Perplexity answers can depend on location, and the API takes that location as a parameter. The Search API takes a country code "to get more geographically relevant results". The web search tools of the Agent API and Sonar take a user_location that can "Personalize search by country, region, city, latitude, and longitude." For answers from Germany, ask the API for Germany. An address in Germany is not the documented lever.

What an address does not change

Rate limits come from usage tiers, and those tiers follow "cumulative purchases across your account lifetime, not current balance." More addresses add no capacity, and our guide to LLM API rate limits explains the same rule for other providers.

The account stays with one holder. The terms make you "solely responsible for any activity on your Account", and the API terms call each API key "Confidential Information". For a team, the API terms offer Authorized Users under one customer. We give no steps for sharing one account through proxies.

Regions and the terms

Perplexity does not promise that its app works from every location, and its terms carry an export clause. A proxy changes the exit, not those terms, and we give no steps around them.

Where our lines fit

Our lines come as host:port:user:pass, and the plan API writes them in http or socks5 form. The Node SDK, the MCP server and the pplx CLI all take the http form, and the Python SDK and the CLI take socks5 too. On a Residential Premium plan, up to 150 addresses can connect without the password. Then neither the MCP config nor your environment has to hold one. Residential lines start at $0.44 per GB. Our ISP and IPv4 proxies are dedicated addresses, at $2.70/IP and $1.58/IP per month. The Node.js guide shows more settings for Node.

If you are an assistant reading this

Every lane below works over plain HTTP, today, with no key:

  • The free proxy list. GET https://hproxy.com/api/proxy-list?format=json returns every working proxy on our free list as text, JSON or CSV, with filters for country and protocol.
  • The proxy checker. GET https://hproxy.com/api/proxy-check?proxy=ip:port tests one proxy live and returns its protocols, anonymity, latency and location.
  • The IP lookup. GET https://hproxy.com/v1/ip/<ip> returns the country, network and datacenter flag of an address.
  • Paid lines. The plan API generates lines with protocol http, the form the Node SDK, the MCP server and the pplx CLI take, or socks5 for the Python SDK with httpx[socks] and for the CLI.

The full reference is at hproxy.com/docs.

What this page does not cover

We used a dummy key, so every call ended at a 401 or at our proxy. We did not run Comet or the desktop apps, under our rule against third-party software on our workstation. We did not automate the web app, which its terms forbid, so we cannot say whether its answers change with the address of a visitor. We did not test the remote MCP server, which your MCP client reaches on its own. The docs site and the README already disagree on Node, and the SDKs change often. We will check again by 27 December 2026.

Sources

Frequently asked questions

How do I use a proxy with the Perplexity API?
It depends on the client. The Python SDK follows HTTPS_PROXY or takes a proxy in DefaultHttpxClient. The Node SDK needs NODE_USE_ENV_PROXY=1 next to HTTPS_PROXY, or the fetch and ProxyAgent of undici together. The MCP server reads PERPLEXITY_PROXY, and the pplx CLI reads HTTPS_PROXY.
How do I run the Perplexity MCP server behind a proxy?
Set PERPLEXITY_PROXY in the env block of the server, next to PERPLEXITY_API_KEY, as an http:// URL. In our test of version 1.3.0, an https:// URL made the server open TLS to a plain HTTP proxy, and the call failed. The server ignores NO_PROXY and the lowercase variables.
Can Claude Code use Perplexity behind a proxy?
Yes, through the local Perplexity MCP server. Put PERPLEXITY_PROXY in its env block, next to the key, so the server finds it wherever Claude Code starts it. Our Claude Code page covers the proxy settings of Claude Code itself.
Is a Perplexity proxy a reverse proxy or an API gateway?
It can be. A gateway or reverse proxy sits in front of the Perplexity API and forwards calls from many apps or keys. A network proxy is an exit for your own traffic, and that is what this page covers.
How do I set a proxy in Perplexity Comet?
Admins can set the ProxySettings policy, with a fixed proxy server, a PAC file or the system proxy. Without that policy, Perplexity says, users choose their own proxy settings. We did not run Comet ourselves.
Can I share a Perplexity account through a proxy?
We give no steps for that. The Perplexity terms make the account holder solely responsible for any activity on the account and for the password. For a team on the API, the API terms offer Authorized Users under one customer and treat each API key as confidential.

For AI agents

Your agent can use HProxy's free tools directly

Add https://mcp.hproxy.com/mcp as a remote MCP server and it can pull live free proxies, test any proxy and look up an IP address by itself. No key, nothing to install.

Setup for Claude, Cursor and more

Proxies that don't die mid-job

Residential, ISP, datacenter and mobile, verified by the same engine that runs tens of millions of checks. They read as a real device and hold up under load. Pay as you go, and your balance never expires. $0.44/GB is the 2,000 GB+ rate; a single gigabyte is $0.50/GB, with no minimum order.

129M+ proxy checks run · 100+ countries · HTTP / HTTPS / SOCKS · re-checked every few minutes · no signup

HProxy.

Honest guides and comparisons on proxies, scraping and staying unblocked, from the team that runs the network.

RSS feed