Skip to main content
Some applications use httpx or requests to talk to model providers directly — for example calling a custom endpoint, a self-hosted model, or a provider whose official Python SDK is not yet supported. The SDK’s HTTP fallback patches these libraries so those calls can be governed too.

When to enable it

Enable the HTTP fallback when:
  • You call an LLM endpoint via httpx.post / requests.post rather than via the official openai, anthropic, or google-genai SDKs.
  • You want broad audit coverage across miscellaneous outbound model traffic.
If you only use the official provider SDKs, you don’t need this — those integrations already cover their full call surface.

Configuration

The HTTP fallback is on by default. Disable it with:

Use

No code changes required — once egisai.init() runs with enable_http_fallback=True (the default), httpx.Client.send and requests.Session.send are wrapped.
The wrapper:
  1. Inspects the URL to identify model-host traffic. The match requires both a known LLM-provider host (OpenAI, Anthropic, Google, Together, Groq, Cohere, Mistral, …) and a known model-call path token (/chat/completions, /responses, /messages, :generateContent, /openai/deployments, …). Ancillary endpoints on the same host (file uploads, traces, audio, embeddings, threads, moderations) are silently ignored to avoid logging unrelated traffic.
  2. Routes the call through the same evaluation pipeline used for the official SDKs.
  3. Audits the verdict.
When a call has already been gated by one of the official-SDK adapters in the same call chain, the HTTP wrapper detects this and skips re-evaluation to avoid double-counting.

Notes and limitations

  • The fallback only inspects bodies it can decode as JSON. Calls using other content types are recorded but not policy-checked.
  • Streaming over HTTP (server-sent events / chunked transfer) is recorded as a single event when the connection closes.
  • For best fidelity with provider-specific call shapes, prefer the official SDK integration when one is available. The HTTP fallback is designed for libraries that bypass the official SDKs entirely (custom endpoints, self-hosted models, providers we haven’t shipped a first-class adapter for yet).

What’s next

Configuration

Troubleshooting