Proxy
Also: 代理伺服器 · proxy server · forward proxy · 反向代理 · 公司網路代理
A middleman between you and the destination: your request goes to it first, it asks on your behalf, then relays the answer back.
When you will meet it
On a corporate or campus network your API calls often do not go out directly — they pass through a proxy. When the same script works at home but times out or returns 407 in the office, it is almost always a proxy blocking or demanding extra authentication in the middle.
An analogy
Like a company switchboard: you cannot dial an outside line directly, you go through the operator, who places the call for you. The operator can log where you called, block certain numbers, and may require ID before connecting you.
Minimal example
# 很多工具會讀這些環境變數來決定要不要走代理
echo "$HTTPS_PROXY" # 例如 http://proxy.corp.example:8080
# 407 Proxy Authentication Required = 代理要求身分認證
# 解法通常是設好代理的帳號密碼,或在該網路下允許直連The point: a proxy is an environment problem, not a bug in your code or key. If the same code works on another network, it is almost certainly the proxy. For "only breaks at the office" failures, asking IT how the proxy is configured beats trial and error.
What people get wrong
- Endlessly resetting keys and reinstalling packages on a corporate network without noticing the proxy is blocking. The test: run it once on another network (e.g. a phone hotspot); if it works, the problem is the network environment, not your config.
- Conflating a proxy with a reverse proxy / API gateway. The forward proxy on your machine goes out on your behalf; something like LiteLLM sitting in front of servers to route and meter traffic is a reverse proxy — the opposite role.