Skip to content

devlog/api-plumbing/corporate-proxy-setup-for-python-sdks-in-your-terminal-97.md

Corporate Proxy Setup for Python SDKs in Your Terminal

Route your terminal through the corporate proxy

A request working in your browser does not prove your SDK can reach the internet. Browsers may inherit managed proxy settings and certificate trust that your terminal never sees. This walkthrough configures a Python OpenAI SDK client on macOS or Linux, then checks each network layer before sending a model request.

Fluxo keeps the application side small: one key and one base URL, https://api.fluxorelay.com, for Claude, GPT, Gemini, DeepSeek, Kimi, GLM, Qwen, Grok and more. Your corporate proxy is a separate hop, not a replacement API endpoint.

Get the approved proxy address and port from IT. Replace the example below with those values, then run these commands in the terminal that will launch your application:

export HTTPS_PROXY='http://proxy.corp.example:8080' — export HTTP_PROXY="$HTTPS_PROXY" — export https_proxy="$HTTPS_PROXY" — export http_proxy="$HTTP_PROXY"

export NO_PROXY='localhost,127.0.0.1,::1' — export no_proxy="$NO_PROXY" — The http scheme is intentional when your proxy accepts ordinary HTTP CONNECT requests, even though the destination uses HTTPS. Use the scheme IT specifies. Do not add api.fluxorelay.com to NO_PROXY unless direct outbound access is explicitly permitted.

Trust the corporate certificate without disabling TLS

If your company inspects TLS, ask IT for an approved PEM CA bundle containing the required corporate and public roots. A lone corporate certificate may break connections to services that bypass inspection. Assume IT has placed that bundle at /path/to/approved-ca-bundle.pem; replace that path before running:

mkdir -p "$HOME/.config/fluxo" — cp /path/to/approved-ca-bundle.pem "$HOME/.config/fluxo/ca-bundle.pem"

export SSL_CERT_FILE="$HOME/.config/fluxo/ca-bundle.pem" — export CURL_CA_BUNDLE="$SSL_CERT_FILE"

export PIP_CERT="$SSL_CERT_FILE" — These settings cover the HTTPX client used below, curl, and pip respectively. If your company does not inspect TLS, keep your normal trust configuration and skip these exports. Never fix certificate failures with curl -k or verify=False; that removes the server identity check.

Check Fluxo connectivity before installing the SDK

Run an unauthenticated request first. It tests proxy routing and TLS without exposing an API key:

curl --connect-timeout 15 --max-time 30 -sS -o /dev/null -w 'HTTP %{http_code}\n' https://api.fluxorelay.com/v1/models

An HTTP response, including an authentication error, means you reached an HTTP service. It does not guarantee the request reached Fluxo rather than a corporate block page. Inspect unexpected responses before proceeding.

If you need a key, you can create a Fluxo account and use it for this walkthrough.

Read the key without putting it directly into shell history. This command uses Bash:

read -r -s -p 'Fluxo API key: ' FLUXO_API_KEY; printf '\n'; export FLUXO_API_KEY

Run the Python SDK through the inherited proxy

Create an isolated environment and install the client: — python3 -m venv .venv

. .venv/bin/activate — python -m pip install --upgrade openai httpx

The OpenAI-compatible route uses /v1 beneath Fluxo's base URL. Discover the available model identifiers instead of guessing a slug from a display name:

python -c 'import os; from openai import OpenAI; c=OpenAI(api_key=os.environ["FLUXO_API_KEY"], base_url="https://api.fluxorelay.com/v1"); print("\n".join(str(m.model_dump()) for m in c.models.list()))'

Find Claude Sonnet 5.5 in that output, copy its exact id, and replace the placeholder:

export FLUXO_MODEL='paste-exact-model-id-here'

Now send a small request. Explicitly enabling environment trust makes the proxy and CA behavior visible in the setup:

python -c 'import os, httpx; from openai import OpenAI; c=OpenAI(api_key=os.environ["FLUXO_API_KEY"], base_url="https://api.fluxorelay.com/v1", http_client=httpx.Client(trust_env=True, timeout=60.0)); r=c.chat.completions.create(model=os.environ["FLUXO_MODEL"], messages=[{"role":"user","content":"Reply with one short greeting."}]); print(r.choices[0].message.content)'

Diagnose proxy failures inside your editor

  • A 407 response means your proxy requires approved authentication configuration.
  • A certificate verification failure usually means the intended CA bundle was not loaded.
  • A connection timeout suggests checking VPN access, proxy availability, and firewall allowlists.
  • An editor task may need restarting before it inherits updated environment variables.

Fluxo also works with Claude Code, Codex, Gemini CLI, and any OpenAI SDK, though each tool's proxy configuration deserves its own check. Billing follows real tokens, including cache reads and writes, with no monthly fee. Invited users' payments also generate a referral share for the inviter.

Keep keys out of logs and committed editor settings. If you need help, leave a note on the contact page after signing in, with sanitized errors rather than credentials.

Next in the buffer

Sign up in a minute and get credit to try every model mentioned here. Sign up →