Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.egisai.co/llms.txt

Use this file to discover all available pages before exploring further.

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-generativeai 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:
egisai.init(..., enable_http_fallback=False)

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.
import egisai
import httpx

egisai.init(app="custom-llm-bot", env="production")

resp = httpx.post(
    "https://api.example-provider.com/v1/generate",
    headers={"Authorization": "Bearer …"},
    json={"prompt": "Hello", "model": "example-large"},
)
The wrapper:
  1. Inspects the URL to identify model-host 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.

What’s next

Configuration

Troubleshooting