Use case

Proxies for Cohere: Why the Python SDK Ignores HTTPS_PROXY, and Where a Proxy Goes Instead

Where a proxy goes for Cohere, from its SDK source and docs: why HTTPS_PROXY stopped working in the Python SDK, the fix, the TypeScript SDK and base URLs.

HProxy Team··5 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→

Cohere sells language, embedding and rerank models through an API, with SDKs for Python and TypeScript. For most tools, a network proxy is one variable, HTTPS_PROXY. For the current Cohere Python SDK it is not, and this page starts with why. It rests on the Cohere docs and SDK source, and on the released Python packages, read on 28 September 2026. We did not run the SDKs for it.

Where the proxy goes

ClientWhere the proxy goes
The dashboardThe browser or the system proxy.
Python SDK 7.0.6 and laterAn HTTPX client with a proxy, in httpx_client.
Python SDK 7.0.5 and earlierHTTPS_PROXY.
TypeScript SDKThe Node switch, or a fetch of your own.
OpenAI SDKs on CohereAs with OpenAI, since only the base URL changes.

Why the Python SDK ignores HTTPS_PROXY

The Python SDK sends its requests through HTTPX, and HTTPX reads the proxy variables by default, with one exception. In its source, the rule is a single line: allow_env_proxies = trust_env and transport is None. Pass a transport, and the environment is skipped.

Since version 7.0.6 of 20 July 2026, the default Cohere client passes one. It builds its sync client with an httpx.HTTPTransport whose socket options keep idle connections alive, and its async client the same way. We read the file out of the released packages: 7.0.5 of 29 June has no transport, and every release from 7.0.6 up to 7.1.1, the latest, has it. So on a current install, HTTPS_PROXY does nothing.

The fix is an option the SDK already has. ClientV2 takes a client of your own in httpx_client:

import httpx
import cohere

proxy = "http://USERNAME:PASSWORD@HOST:PORT"
co = cohere.ClientV2(httpx_client=httpx.Client(proxy=proxy, timeout=300))
# the key comes from CO_API_KEY; AsyncClientV2 takes an httpx.AsyncClient

Set the timeout yourself. The SDK applies its default of 300 seconds only to the client it builds, so a client passed in keeps the default of HTTPX, which is much shorter than a long generation. Our HTTPX guide covers the proxy argument in detail.

The TypeScript SDK and the OpenAI SDKs

The TypeScript SDK, cohere-ai 8.1.0, calls the global fetch. On Node, that fetch reads HTTPS_PROXY only when Node starts with NODE_USE_ENV_PROXY=1, which fetch has supported since Node 24.0.0 and 22.21.0. The client also takes a fetch of your own in its fetch option, for setups that need one.

export HTTPS_PROXY="http://USERNAME:PASSWORD@HOST:PORT"
export NODE_USE_ENV_PROXY=1   # Node only
node app.mjs

Cohere also answers in the OpenAI format, at https://api.cohere.ai/compatibility/v1. With that base URL and a Cohere key, the OpenAI SDKs behave as our lab of 27 September found with OpenAI. The Python SDK follows HTTPS_PROXY, and the Node SDK follows it only with the Node switch. Our ChatGPT page has the full results.

What a proxy does not change

The limits. Cohere has two kinds of key. Trial keys are free and "limited to 1,000 API calls a month", with 20 requests a minute on the Chat models. Production keys allow 500 a minute on Command A. The limits come with the key, so a different exit address changes nothing.

The terms. The Cohere terms of use bar anyone from trying to "bypass any measures we may use to prevent or restrict access to the Cohere Solution". They also bar exporting it to anyone "subject to applicable export controls or sanctions". We give no steps around either.

Where our lines fit

A proxy of your own fits Cohere in plain cases: a company network where every client leaves through one egress, a server whose traffic should leave from one fixed address, and the scrapers that feed a retrieval pipeline. From our server in a data center, both Cohere APIs answered with a plain 401 for the missing key, with no challenge. A dedicated ISP or IPv4 address stays the same, at $2.70/IP and $1.58/IP per month, and residential lines start at $0.44 per GB.

Our lines come as host:port:user:pass and generate in the http form by default, the form an HTTPX proxy and the Node switch take. On a Residential Premium plan, up to 150 addresses can connect without the password, so none has to sit in your code. Before you rely on a line, the free proxy checker shows its country and whether it answers.

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 that an HTTPX proxy and HTTPS_PROXY take. Dedicated addresses are listed by the proxies API.

The full reference is at hproxy.com/docs.

What this page does not cover

We did not install or run the Cohere SDKs for this page. The Python finding rests on the SDK source, on the file read out of each released package, and on the HTTPX rule, not on a lab. We did not read what the optional aiohttp client of the Python SDK does with proxies. An open change would move the SDK from HTTPX to HTTPX2, and it may alter all of this. We will check again by 28 December 2026.

Sources

Frequently asked questions

Why does the Cohere Python SDK ignore HTTPS_PROXY?
Since version 7.0.6 of 20 July 2026, it builds its default HTTPX client with a transport of its own, for TCP keepalive. HTTPX reads the proxy variables only when no transport is passed, so HTTPS_PROXY is skipped. Version 7.0.5 and earlier still read it.
How do I use the Cohere Python SDK behind a proxy?
Pass an HTTPX client with the proxy in httpx_client: cohere.ClientV2(httpx_client=httpx.Client(proxy=..., timeout=300)). Set the timeout yourself, since the SDK applies its 300-second default only to its own client. AsyncClientV2 takes an httpx.AsyncClient the same way.
How do I use the Cohere TypeScript SDK behind a proxy?
It calls the global fetch. On Node, set HTTPS_PROXY and start Node with NODE_USE_ENV_PROXY=1, which fetch has supported since Node 24.0.0 and 22.21.0. The client also takes a fetch of your own in its fetch option.
What is the Cohere API base URL?
The SDKs call https://api.cohere.com, and the Python SDK reads another address from CO_API_URL. OpenAI clients use the compatibility API at https://api.cohere.ai/compatibility/v1.
Can I use the OpenAI SDK with Cohere?
Yes, with the base URL set to https://api.cohere.ai/compatibility/v1 and a Cohere key. The proxy then works as it does with OpenAI: the Python SDK follows HTTPS_PROXY, and the Node SDK needs NODE_USE_ENV_PROXY=1.
Is a Cohere API key free, and does a proxy raise its limits?
Trial keys are free and limited to 1,000 API calls a month, with 20 requests a minute on the Chat models. The limits come with the key, so a different exit address changes nothing.

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