Skip to main content
Transparent PII anonymization and rehydration for LLM API calls. Available in Node.js and Bun only.

Import


wrapLLMClient()

Wraps an OpenAI or Anthropic SDK client for automatic anonymization/rehydration.

Signature

Parameters

client
T
required
An OpenAI or Anthropic SDK client instance
config
RehydraFetchConfig
Configuration (see RehydraFetchConfig)

Returns

The same client type T, with fetch intercepted for anonymization.

Example


createRehydraFetch()

Creates a drop-in fetch replacement that anonymizes requests and rehydrates responses.

Signature

Parameters

config
RehydraFetchConfig
required
Configuration (see RehydraFetchConfig)

Returns

A fetch-compatible function.

Example


createRehydraProxy()

Creates an HTTP proxy middleware using the Web Request/Response API.

Signature

Parameters

config
RehydraProxyConfig
required
Configuration (see RehydraProxyConfig)

Returns

A function (request: Request) => Promise<Response> compatible with Bun.serve, Hono, and other frameworks using Web APIs.

Example


createRehydraProxyServer()

Creates and starts a standalone HTTP proxy server.

Signature

Parameters

config
RehydraProxyServerConfig
required
Extends RehydraProxyConfig with:

Returns

Example


Configuration Types

RehydraFetchConfig

RehydraProxyConfig

Extends RehydraFetchConfig with:

Providers

detectProvider()

Auto-detect the LLM provider from request URL and headers.

LLMContentProvider Interface

Built-in Providers


SSEParser

Parser for Server-Sent Events streams.