Skip to content

Zero Data Retention ​

Zero data retention (ZDR) means a call leaves nothing behind at the provider once it is answered: no stored prompts or outputs, no abuse-monitoring logs, no training.

Requiring ZDR ​

A call requires ZDR when its metadata says zdr: true (per call, or in the AI's defaultMetadata) or when its provider's config says privacy.requireZDR:

typescript
// Every call through this AI
const ai = AI.with()
  .providers({ openai, openrouter })
  .create({ defaultMetadata: { zdr: true } });

// One call
const response = await ai.chat.get(
  { messages: [{ role: 'user', content: 'Summarize this contract: ...' }] },
  { metadata: { zdr: true } },
);

Once set, by the defaults or the call, it stays set. Then:

  • Selection only picks models whose provider can call them with ZDR.
  • A model named outright that can't be called with ZDR is refused with a ZDRError (provider, model, reason) before anything is sent.
  • The provider sends what holds ZDR on its API (OpenRouter provider.zdr: true and data_collection: 'deny', OpenAI store: false) and refuses what can't keep it (batches, file uploads, server tools, …).

A provider that doesn't say how it holds ZDR is never called when ZDR is required.

How each provider holds it ​

ProviderHowConfig
OpenRouterPer request: routed only to ZDR endpointsdefaultParams.providers.zdr: true requires it for every call
OpenAIPer account: an organization or project with a ZDR arrangementprivacy: { zdrAccount: true }
AnthropicPer account, by agreementprivacy: { zdrAccount: true }
AWS BedrockPer account: data retention mode noneprivacy: { zdrAccount: true }
OllamaThe host keeps nothing (local, or Ollama's cloud)—
GoogleGemini API: none, every call is refused when ZDR is required. Vertex AI: per project, set up for ZDRVertex AI: privacy: { zdrAccount: true }
ReplicateNo ZDR: never called when ZDR is required—
typescript
const openai = new OpenAIProvider({
  apiKey: process.env.OPENAI_API_KEY!,
  privacy: {
    zdrAccount: true,   // this organization has a ZDR arrangement with OpenAI
    requireZDR: true,   // and every call through this provider requires it
  },
});

Without zdrAccount, account-based providers refuse calls that require ZDR.

For Bedrock, zdrStatus() reads the account's logging and data retention settings and says whether zdrAccount is warranted.

Per-model data ​

ModelInfo.privacy says what a provider keeps of a call to a model, and the zdr capability agrees with it:

typescript
interface ModelPrivacy {
  zdr?: boolean;                       // can be called with nothing kept (unset: unknown)
  zdrBy?: 'request' | 'account' | 'host';
  reason?: string;                     // why not, when zdr is false
  zdrEndpoints?: string[];             // OpenRouter: the upstream endpoints that serve it with ZDR
  safetyRetention?: string[];          // of those, the ones that may keep content flagged for safety review
}

@aeye/models fills it from OpenRouter's ZDR endpoint list and the providers' documentation (for example, Claude models that need 30-day retention are refused to ZDR organizations). A custom provider implements zdrRefusal(model, config) (returning why a model can't be called with ZDR, or undefined) with the zdrRefusal helper from @aeye/ai, and requiresZDR(config).

Released under the GPL-3.0 License.