Skip to content

devlog/api-plumbing/sdk-proxy-settings-that-stop-terminal-retry-bills-487.md

SDK Proxy Settings That Stop Terminal Retry Bills

SDK Proxy Settings That Stop Terminal Retry Bills

A corporate firewall can turn one small SDK change into an afternoon of failed requests. The expensive part is not always the network error: it is the retry loop that keeps sending work after your terminal stops receiving answers. My playbook is simple: prove the route, fix certificate trust, and only then spend tokens.

Separate the corporate proxy from the API base URL

Your corporate proxy and your API relay have different jobs. The proxy carries outbound traffic through your company’s network controls. The SDK base URL selects the API destination. Putting the corporate proxy address into base_url does not configure HTTP tunneling; it sends API requests to the wrong server.

With Fluxo, the destination is https://api.fluxorelay.com. One key and one base URL cover Claude, GPT, Gemini, DeepSeek, Kimi, GLM, Qwen, Grok, and more. Keep that destination separate from the corporate proxy configuration, and use your client’s documented API-path conventions rather than guessing whether it appends a version prefix.

Check HTTPS_PROXY before spending tokens

Start in the same terminal that launches your SDK or editor. A desktop editor opened from the dock may not inherit variables exported in your shell. Restart its integrated terminal or launch the editor from the configured shell before comparing results.

  • Set HTTPS_PROXY to the proxy address supplied by your network team.
  • Set HTTP_PROXY only when your tools also require HTTP routing.
  • Keep NO_PROXY limited to destinations approved for direct connections.
  • Check uppercase and lowercase variable handling in your actual runtime.

An HTTPS destination commonly uses an HTTP proxy URL, such as http://proxy.corp.internal:8080. The client asks that proxy to establish a CONNECT tunnel. Do not change the scheme to https merely because the destination uses TLS; the scheme describes the connection to the proxy.

Try curl -I --connect-timeout 10 https://api.fluxorelay.com. Even a 404 or 405 can establish that HTTP traffic reached something, but inspect the response: a corporate block page is not the API. This probe does not prove authentication or generation works, and it should not request model output.

Make Python and Node SDK proxy behavior explicit

Do not assume every SDK reads proxy environment variables. For Python clients using HTTPX, current HTTPX versions support httpx.Client(proxy="http://proxy.corp.internal:8080"). Pass that client through the SDK’s supported HTTP-client option. HTTPX also supports environment-based configuration by default; trust_env=False disables that behavior, including environment-based certificate settings.

In Node, behavior depends on the runtime, HTTP library, and SDK version. Setting HTTPS_PROXY alone is not a universal solution. For a fetch-based SDK that accepts a custom fetch implementation, one option is Undici’s fetch with a ProxyAgent dispatcher. Use EnvHttpProxyAgent instead when you specifically need environment-driven proxy selection and bypass rules, subject to your installed Undici version.

Fluxo works with Claude Code, Codex, Gemini CLI, and any OpenAI SDK, but endpoint compatibility does not make their networking settings identical. Configure and test each tool independently before copying settings across your workstation.

Trust the corporate CA without disabling TLS

If your company inspects HTTPS, obtain its approved root certificate through your IT process. Configure the relevant trust store or CA bundle. Python HTTPX can use SSL_CERT_FILE; Node commonly uses NODE_EXTRA_CA_CERTS, set before process startup. Verify your runtime’s behavior rather than assuming the operating system’s trust store is enough.

Never solve certificate failures with verify=False or NODE_TLS_REJECT_UNAUTHORIZED=0. Also keep proxy passwords and API keys out of committed configuration, screenshots, shell history, and diagnostic logs.

Cap retries before your first billable request

Temporarily disable automatic retries and send one tiny request using the exact dashboard model identifier for Claude Haiku 4.5 or DeepSeek V4 Flash. Set a small output limit and an explicit timeout. A dropped response does not prove the upstream generation stopped, so blindly retrying can duplicate billable work.

Fluxo bills real tokens, including cache reads and writes, with no monthly fee. Compare usage records after testing; do not assume cached requests are free. Restore only a small, bounded retry policy once the route is reliable.

If this setup fits your workflow, you can create a Fluxo account for a small end-to-end test. Referral shares accrue when invited users pay; treat them as incidental savings, not a substitute for usage controls. If you need help, leave a note on the contact page after signing in.

Next in the buffer

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