Skip to content

Bring your own HTTP client (proxy, credentials, TLS)

toolnexus does not invent proxy, credential, or TLS configuration. Behind a corporate proxy, a mutual-TLS gateway, an SSO egress that wants a custom header — your platform already has one right way to configure an HTTP client. So every port exposes the exact HTTP client it uses for LLM calls as an injection point: you build the client however your stack does it, hand it in, and toolnexus uses it for every request, including its own retry/backoff loop. Nothing is wrapped or re-implemented.

Two seams, side by side:

  • The HTTP client — a full client object you own (proxy, TLS, timeouts, custom transport). This is the “use the system proxy / use my client” answer.
  • headers — extra headers merged onto every LLM request (a gateway token, a tracing id). Values are use-only; read them from the environment, never bake them in.
import { ProxyAgent } from "undici"
// your fetch, your proxy — undici honors the corporate proxy + auth
const dispatcher = new ProxyAgent(process.env.HTTPS_PROXY)
const myFetch = (url, init) => fetch(url, { ...init, dispatcher })
const agent = createClient({
baseUrl: "https://openrouter.ai/api/v1", style: "openai",
model: "openai/gpt-4o-mini", apiKey: process.env.OPENROUTER_API_KEY,
fetch: myFetch, // ← toolnexus calls this for every request
headers: { "X-Egress-Token": process.env.EGRESS_TOKEN },
})

The injection seam per port:

Port HTTP client seam Extra headers
JavaScript fetch (any fetch-shaped fn) headers
Python http_transport (tiny post/open protocol; default honors proxy env) headers
Go HTTPClient (*http.Client; default honors proxy env) Headers
Java httpClient (java.net.http.HttpClient) headers
C# HttpClient or HttpHandler (default honors system proxy) Headers
Elixir http_options (Req/Finch options) headers

Scope is the LLM path only — MCP transports use their own SDK clients. Whatever your client does (mTLS, a recording double in tests, an observability transport, a corporate egress proxy), toolnexus just uses it.

Next: Multi-turn memory.