---
title: "Keep Prompts Private"
description: "Require no training and zero data retention for one synthetic prompt, then verify how those requirements changed provider eligibility."
canonical_url: "https://vercel.com/academy/ai-gateway/keep-prompts-private"
md_url: "https://vercel.com/academy/ai-gateway/keep-prompts-private.md"
docset_id: "vercel-academy"
doc_version: "1.0"
last_updated: "2026-08-08T23:27:13.493Z"
content_type: "lesson"
course: "ai-gateway"
course_title: "Using AI Gateway in Production"
prerequisites:  []
---

<agent-instructions>
Vercel Academy — structured learning, not reference docs.
Lessons are sequenced.
Adapt commands to the human's actual environment (OS, package manager, shell, editor) — detect from project context or ask, don't assume.
The lesson shows one path; if the human's project diverges, adapt concepts to their setup.
Preserve the learning goal over literal steps.
Quizzes are pedagogical — engage, don't spoil.
Quiz answers are included for your reference.
</agent-instructions>

# Keep Prompts Private

# How Do I Keep My Prompts Private?

Prompts can contain internal instructions, customer context, support history, or the taco recipe that keeps the lunch line moving.

Privacy belongs in the routing requirements. AI Gateway can remove providers that do not satisfy the policy before the prompt is sent.

\*\*Note: Quick Answer\*\*

Set `disallowPromptTraining: true` in `providerOptions.gateway` to exclude providers without a no-training agreement. Add `zeroDataRetention: true` when the request also requires an eligible zero-retention policy. Inspect `routing.planningReasoning`; if no provider qualifies, the request fails with `no_providers_available`.

## Outcome

Send one synthetic sensitive prompt with both privacy controls and verify that the routing plan respected them.

## Fast Track

1. Add both privacy fields under `providerOptions.gateway`
2. Run `pnpm private-prompts`
3. Verify `planningReasoning`, or inspect a safe `no_providers_available` failure

## Hands-on exercise

Create `scripts/private-prompts.ts`. Use synthetic content; privacy controls are not a reason to put real secrets in a course exercise.

```ts filename="scripts/private-prompts.ts"
import { generateText } from "ai";

const result = await generateText({
  model: "anthropic/claude-sonnet-4.6",
  prompt:
    "Our secret: La Consecuencia gets exactly three ghost peppers, torched, " +
    "never boiled. Draft one sentence warning customers, without the recipe.",
  providerOptions: {
    gateway: {
      disallowPromptTraining: true,
      zeroDataRetention: true,
    },
  },
});

const routing = result.finalStep.providerMetadata?.gateway?.routing as any;

console.log(result.text.trim());
console.log("---");
console.log(`Served by: ${routing?.finalProvider}`);
console.log(`Routing:   ${routing?.planningReasoning}`);
```

## Try It

Run it:

```bash
pnpm private-prompts
```

A successful answer alone is not proof. Confirm that the output includes the serving provider and planning reasoning. Depending on current model and provider policy, the correct result may instead be `no_providers_available`. That failure is the privacy control doing its job.

\*\*Warning: BYOK changes the policy boundary\*\*

BYOK traffic runs under your agreement with the provider. Do not assume a Gateway system-credential policy automatically describes retention under your own key. Check the selected model, provider, and credential type together.

The two filters compose. The Gateway should not satisfy one by ignoring the other. Model-specific retention exceptions also exist, so re-check the current policy before sending sensitive production data.

## Commit

```bash
git commit -m "feat(privacy): require no training and zero data retention"
```

## Done-When

- [ ] Both privacy options are enabled in the request
- [ ] The output includes routing planning metadata, or the request safely fails because no provider qualifies
- [ ] You can explain why a successful answer without routing evidence is insufficient
- [ ] The exercise contains no real secret or customer data

## Solution

The script treats privacy requirements as provider filters and keeps routing metadata as evidence. A successful answer without that evidence does not confirm which policy was applied.

## Related Questions

- [How do I see where my money is going?](/ai-gateway/stay-aware/see-your-spend)
- [How do I pin routing to a provider?](/ai-gateway/stay-reliable/pin-a-provider)
- [How do I bring my own provider keys?](/ai-gateway/save-money/bring-your-own-keys)


---

[Full course index](/academy/llms.txt) · [Sitemap](/academy/sitemap.md)
