4 HTTP middleware adapters (Express, Fastify, Hono, Next.js) that inject compliance headers from SDK responses.
The SDK provides HTTP middleware adapters that extract compliance metadata from LLM responses and inject them as HTTP headers. This enables downstream services, API gateways, and monitoring tools to observe compliance status.
import express from 'express';import { compliorExpress } from '@complior/sdk/middleware';const app = express();// Apply globallyapp.use(compliorExpress());// Or with header filteringapp.use(compliorExpress({ headers: { include: ['X-AI-Disclosure', 'X-Compliance-Score'], // or exclude: ['X-Bias-Score'] },}));app.post('/api/chat', async (req, res) => { const response = await client.chat.completions.create({ /* ... */ }); res.json(response); // Headers automatically injected before response is sent});
The Express adapter intercepts res.write() and res.end() to capture the response body, extract compliance metadata, and set headers before the response is finalized.