How It Works
- Your API endpoint calls the SDK-wrapped LLM client
- The SDK attaches
_compliormetadata to the LLM response - The HTTP middleware intercepts outgoing responses
- Metadata is extracted and injected as HTTP headers
Compliance Headers
Express
res.write() and res.end() to capture the response body, extract compliance metadata, and set headers before the response is finalized.
Fastify
onSend hook to intercept the serialized payload.
Hono
next(), then clones the response to extract metadata and set headers.
Streaming responses may not be clonable — header injection is silently skipped in that case.
Next.js
res.json() and res.send() to inject headers before the response is sent.
Header Filtering
All adapters accept aMiddlewareOptions object:
- If
includeis set, only listed headers are injected - If
excludeis set, listed headers are removed from output - Both can be combined —
includeis applied first, thenexclude
Configuration
SDK configuration reference.
Providers
Supported LLM providers.