How much does an AI need to know?
DataDuck is a privacy API that sits between an application and its AI provider. It pseudonymizes outgoing messages, calls the selected model, and restores identifying details locally in the response. I built it for a client to integrate into their applications.
The UI shown here is a demo interface for the API. It exposes each step so the filtering and restoration can be inspected. Applications can use the API within their own interfaces and workflows.
Three layers, three colours
An ordinary message can mix known customers, unfamiliar names and contact details. Each needs a different kind of protection.
Blue is the dictionary: it recognises known contacts and companies, preserving their connection to business records. Amber is rules and validators: they catch structured details such as emails, phone numbers and IBANs. Purple is GLiNER, a local entity-recognition model: it identifies text fragments such as “Mario Rossi” as a person or “Acme” as an organisation, including names outside the dictionary. These detections feed the filter before the message reaches the answering model. If the checks cannot complete, the request is blocked.

The four panels make that exchange visible. Follow a name across them: it becomes a placeholder, appears in the model's response, then returns locally in green. Uncertain identity matches are left for the user to resolve.
Ask the business question
“Who are our best five customers?” The model receives the filtered question and database schema, then writes SQL. DataDuck runs it locally with read-only access; customer names and actual figures stay inside the app.
For an AI comment, a separate representation goes out: placeholders for identities, relative indices for numbers. The model reasons about those comparisons, and DataDuck restores names and referenced figures locally. The interface shows the query, the results and exactly what the model received.

A record of what left
The log keeps the outgoing messages beside the raw response, with their time, provider and conversation reference. Both retain the placeholders. Someone can return to an exchange and inspect what the model actually saw, before local restoration.

FOR NERD ONLY
Application → DataDuck API → AI provider → DataDuck API → Application
The TypeScript backend controls the workflow and uses effect/ai's LanguageModel.generateText to call Claude or a local model through an OpenAI-compatible API. GLiNER runs locally inside the filter to detect entities; the answering model generates replies or SQL from the filtered input. DataDuck controls query execution and restoration, rather than delegating them to an autonomous agent.
PostgreSQL separates the analytical lake from the identity vault, with a lake schema and database role per space. Generated queries run locally in read-only transactions with a ten-second timeout.



