AI Gateway Zero Data Retention (ZDR)
Zero data retention (ZDR) is available on AI Gateway for Pro and Enterprise teams and for any team that has purchased AI Gateway credits. See Availability for details. There are two ways to enforce ZDR:
- Team-wide: Enable ZDR globally from the AI Gateway Dashboard Settings tab. Once enabled, all requests are routed to ZDR-compliant providers.
- Per-request: Set
zeroDataRetention: trueinproviderOptions.gatewayfor individual requests. This gives you fine-grained control over which requests require ZDR.
These two methods work as an OR: if either is enabled, ZDR is enforced for that request.
ZDR and disallowing prompt training are separate controls.
| Option | Cost |
|---|---|
| Per-request zero data retention | No additional cost |
| Team-wide zero data retention | $0.10 per 1,000 requests |
Team-wide ZDR is charged on each request AI Gateway bills. That includes a request billed without completing normally, such as a response the provider blocks on safety grounds and still charges for. Requests that fail and that AI Gateway doesn't bill are not charged.
Per-request and team-wide ZDR both require a paid account, which means a Pro or Enterprise plan or purchased AI Gateway credits. Hobby teams and teams on a Pro trial can use ZDR once they purchase credits. Free credits don't count.
With an active Token Pass, you can also use per-request ZDR for as long as the pass is active, even after you've used its monthly credit. Turning on team-wide ZDR in the dashboard still requires a Pro or Enterprise plan or purchased AI Gateway credits.
If you request ZDR from a team that isn't eligible, AI Gateway returns a 403:
{
"error": "Zero Data Retention (ZDR) requires a paid account. Current plan: hobby. Please purchase AI Gateway credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up or upgrade your plan at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fsettings%2Fbilling to access this feature. If you purchased credits in the last few minutes, retry shortly.",
"type": "permission_denied",
"statusCode": 403
}AI Gateway checks your payment status again before it returns this error, so a credit purchase usually applies to your next request. If you purchased credits in the last few minutes and still get a 403, retry shortly.
AI Gateway has a ZDR policy and does not retain the prompts or responses in your requests. That content is immediately and permanently deleted after requests are completed. No action is needed on the user side.
AI Gateway does record request metadata for billing, observability, and debugging, such as the model, provider, token usage, cost, and duration. For the full list, see what AI Gateway logs about your requests.
AI Gateway has agreements in place to offer ZDR with specific providers. A provider's default policy may not match with the status that AI Gateway has in place due to these agreements.
By default, AI Gateway does not route based on the data retention policy of providers.
ZDR applies per model and per provider. A provider in the ZDR providers list can offer ZDR for some of its models and not for others, and some tools and request types fall outside a provider's ZDR policy.
With ZDR enabled, AI Gateway handles each case as follows:
| Case | What AI Gateway does |
|---|---|
| A provider doesn't offer ZDR for the model you request | Skips that provider and routes to one that does. If none remain, the request fails with a no_zdr_providers_available error. |
| The model retains data on every provider, such as the Claude Fable models | Fails the request. |
| Tools that AI Gateway runs, such as the AI Gateway search and fetch tools | Fails the request with a 400 error when the tool's vendor has no ZDR commitment. The error names the tool and the vendor. |
| Batch jobs | Rejects the batch at submission, because providers store batch inputs and results for the lifetime of the batch. Send synchronous requests instead. |
| Asynchronous video jobs | Rejects the job at submission. Asynchronous video jobs don't support ZDR yet. |
| Tools that the provider runs, such as provider-specific web search or grounding | Doesn't block the request. A separate service can process and retain the data you send to the tool, under its own terms. |
| Prompt caching | Doesn't block the request. AI Gateway doesn't count a provider's short-lived prompt cache as retaining data. |
These cases describe requests served with Vercel's provider keys. With a BYOK key that you marked as ZDR, your own agreement with the provider decides which models and tools are covered.
Pro and Enterprise teams, and teams that have purchased AI Gateway credits, can enable ZDR globally for all requests from the AI Gateway Dashboard. If your team isn't eligible, you can't turn on the toggle, and the settings page links to buying AI Gateway credits. If your team stops being eligible while team-wide ZDR is on, for example after downgrading from Pro, you can still turn it off.
To enable team-wide ZDR:
- Go to the AI Gateway Dashboard
- Navigate to the Settings tab
- Toggle on the Zero Data Retention option
Once enabled, team-wide ZDR applies to all requests through the Vercel team you configured it for. For how team-wide ZDR interacts with BYOK keys, see BYOK.
Team-wide ZDR and team-wide disallow prompt training are separate settings, and turning on one doesn't turn on the other. To enforce both for your team, turn on both the Zero Data Retention and Disallow Prompt Training toggles. Team-wide disallow prompt training has no additional cost.
You can enforce ZDR on individual requests using the zeroDataRetention parameter in providerOptions.gateway. Set zeroDataRetention to true to route the request only through providers that have zero data retention agreements with Vercel AI Gateway.
If your team isn't eligible for ZDR, the request fails with a 403 (see Availability). If no ZDR-compliant providers are available for the requested model, the request fails with an error:
{
"error": "No ZDR (Zero Data Retention) providers or ZDR-attested BYOK credentials available for model: example/model-name. Providers considered: provider-a, provider-b",
"type": "no_zdr_providers_available",
"statusCode": 400
}When ZDR is enabled, successful responses include enabledZeroDataRetention: true in the gateway metadata. The routing.skippedProviderAttempts array lists each provider AI Gateway removed for ZDR, with the reason:
{
"gateway": {
"routing": {
"skippedProviderAttempts": [
{
"provider": "provider-c",
"credentialType": "system",
"reason": "zdr_not_supported"
}
]
},
"enabledZeroDataRetention": true
}
}| Reason | Meaning |
|---|---|
zdr_not_supported | The provider doesn't offer ZDR for this model. |
zdr_not_attested | Your BYOK key for this provider isn't marked as ZDR-compliant. See BYOK. |
zdr_ineligible_model | The model retains data, so no provider can serve it with ZDR. |
ZDR enforcement also applies to any fallback providers. For how per-request ZDR interacts with BYOK keys, see BYOK.
These examples use AI SDK 7 and the AI SDK for Python beta. Set AI_GATEWAY_API_KEY before running them. See API format differences for setup, request fields, and response handling.
See the AI SDK zero-data-retention reference for SDK configuration and usage.
import { generateText } from 'ai';
const { text } = await generateText({
model: 'anthropic/claude-sonnet-5',
prompt: 'Analyze this example business data: revenue grew by 5%.',
providerOptions: {
gateway: {
zeroDataRetention: true,
},
},
});
console.log(text);import asyncio
import ai
async def main():
model = ai.get_model("anthropic/claude-sonnet-5")
messages = [ai.user_message("Analyze this example business data: revenue grew by 5%.")]
params = ai.InferenceRequestParams(
extra_body={"providerOptions": {"gateway": {"zeroDataRetention": True}}}
)
async with ai.stream(model, messages, params=params) as stream:
async for event in stream:
if isinstance(event, ai.events.TextDelta):
print(event.chunk, end="", flush=True)
print()
asyncio.run(main())import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.AI_GATEWAY_API_KEY,
baseURL: 'https://ai-gateway.vercel.sh/v1',
});
const response = await client.chat.completions.create({
model: 'anthropic/claude-sonnet-5',
messages: [
{
role: 'user',
content: 'Analyze this example business data: revenue grew by 5%.',
},
],
// AI Gateway extension fields are not included in the upstream SDK types.
...{
providerOptions: {
gateway: {
zeroDataRetention: true,
},
},
},
});
console.log(response.choices[0]?.message.content);import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AI_GATEWAY_API_KEY"],
base_url="https://ai-gateway.vercel.sh/v1",
)
response = client.chat.completions.create(
model="anthropic/claude-sonnet-5",
messages=[{"role": "user", "content": "Analyze this example business data: revenue grew by 5%."}],
extra_body={"providerOptions": {"gateway": {"zeroDataRetention": True}}},
)
print(response.choices[0].message.content)curl --fail-with-body https://ai-gateway.vercel.sh/v1/chat/completions -H "Authorization: Bearer $AI_GATEWAY_API_KEY" -H "Content-Type: application/json" -d '{
"model": "anthropic/claude-sonnet-5",
"messages": [
{
"role": "user",
"content": "Analyze this example business data: revenue grew by 5%."
}
],
"providerOptions": {
"gateway": {
"zeroDataRetention": true
}
}
}'import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({
apiKey: process.env.AI_GATEWAY_API_KEY,
baseURL: 'https://ai-gateway.vercel.sh',
});
const response = await client.messages.create({
model: 'anthropic/claude-sonnet-5',
messages: [
{
role: 'user',
content: 'Analyze this example business data: revenue grew by 5%.',
},
],
max_tokens: 1024,
...{
providerOptions: {
gateway: {
zeroDataRetention: true,
},
},
},
});
for (const block of response.content) {
if (block.type === 'text') console.log(block.text);
}import os
from anthropic import Anthropic
client = Anthropic(
api_key=os.environ["AI_GATEWAY_API_KEY"],
base_url="https://ai-gateway.vercel.sh",
)
response = client.messages.create(
model="anthropic/claude-sonnet-5",
messages=[{"role": "user", "content": "Analyze this example business data: revenue grew by 5%."}],
max_tokens=1024,
extra_body={"providerOptions": {"gateway": {"zeroDataRetention": True}}},
)
for block in response.content:
if block.type == "text":
print(block.text)curl --fail-with-body https://ai-gateway.vercel.sh/v1/messages -H "Authorization: Bearer $AI_GATEWAY_API_KEY" -H "Content-Type: application/json" -H "anthropic-version: 2023-06-01" -d '{
"model": "anthropic/claude-sonnet-5",
"messages": [
{
"role": "user",
"content": "Analyze this example business data: revenue grew by 5%."
}
],
"max_tokens": 1024,
"providerOptions": {
"gateway": {
"zeroDataRetention": true
}
}
}'import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.AI_GATEWAY_API_KEY,
baseURL: 'https://ai-gateway.vercel.sh/v1',
});
const response = await client.responses.create({
model: 'anthropic/claude-sonnet-5',
input: 'Analyze this example business data: revenue grew by 5%.',
...{
providerOptions: {
gateway: {
zeroDataRetention: true,
},
},
},
});
console.log(response.output_text);import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AI_GATEWAY_API_KEY"],
base_url="https://ai-gateway.vercel.sh/v1",
)
response = client.responses.create(
model="anthropic/claude-sonnet-5",
input="Analyze this example business data: revenue grew by 5%.",
extra_body={"providerOptions": {"gateway": {"zeroDataRetention": True}}},
)
print(response.output_text)curl --fail-with-body https://ai-gateway.vercel.sh/v1/responses -H "Authorization: Bearer $AI_GATEWAY_API_KEY" -H "Content-Type: application/json" -d '{
"model": "anthropic/claude-sonnet-5",
"input": "Analyze this example business data: revenue grew by 5%.",
"providerOptions": {
"gateway": {
"zeroDataRetention": true
}
}
}'When ZDR is enabled, either team-wide or per-request, AI Gateway skips your BYOK keys by default. BYOK keys operate under your own agreements and permissions with providers, which can differ from the ZDR agreements Vercel has negotiated for its own provider keys.
If you have your own ZDR agreement with a provider, you can mark a BYOK key as ZDR-compliant. AI Gateway then includes that key in the ZDR routing set. This option applies to both team-wide and request-level ZDR.
Marking a key as ZDR makes it eligible for ZDR routing. It does not enable ZDR by itself. ZDR routing applies only when team-wide ZDR is on or the request sets zeroDataRetention: true.
To mark a BYOK key as ZDR:
- Go to the AI Gateway Bring Your Own Key (BYOK) page in your Vercel dashboard.
- Add a new key or edit an existing one.
- Toggle on Zero Data Retention.
When ZDR is enabled, AI Gateway filters the routing set for each model to ZDR-compliant providers only:
- If you have BYOK keys for a ZDR-compliant provider that you marked as ZDR, AI Gateway tries those keys first.
- If those BYOK keys fail or are unavailable, AI Gateway falls back to Vercel's provider keys for the ZDR-compliant providers in the routing set. If your team turned off Fallback to Vercel Keys, the request fails instead.
- If no ZDR-compliant providers are available for the model, the request fails with a
no_zdr_providers_availableerror.
Consider the following setup:
- You have a BYOK key for Anthropic, marked as ZDR, because you have a direct ZDR agreement with Anthropic.
- You have a BYOK key for Google Vertex, not marked as ZDR.
- You have a BYOK key for OpenAI, not marked as ZDR.
- You send a request to
anthropic/claude-sonnet-5withzeroDataRetention: true.
AI Gateway builds the ZDR routing set in two parts.
BYOK routing set:
- Your BYOK keys: Anthropic, Google Vertex, OpenAI
- Filter to ZDR-marked keys: Anthropic
- Filter to keys for providers serving
anthropic/claude-sonnet-5: Anthropic
Routing set for Vercel's provider keys:
- Providers that serve
anthropic/claude-sonnet-5on Vercel's provider keys: Anthropic, Google Vertex, Amazon Bedrock - Filter to providers Vercel has ZDR agreements with: Anthropic, Google Vertex, Amazon Bedrock
Final routing order:
- Anthropic BYOK (ZDR-marked) is tried first.
- If that fails, AI Gateway falls back to Vercel's provider keys for Anthropic, Google Vertex, or Amazon Bedrock. With Fallback to Vercel Keys off, the request fails instead.
Your Google Vertex BYOK is filtered out because you didn't mark it as ZDR, but Google Vertex is still reachable through Vercel's provider keys. With Fallback to Vercel Keys off, it isn't. Your OpenAI BYOK is filtered out because OpenAI doesn't serve anthropic/claude-sonnet-5.
Team-wide ZDR toggled to enabled overrides request-level zeroDataRetention: false since these options work together as an OR. If either option is enabled, ZDR is enforced on the request.
When you use prompt caching through AI Gateway, caching happens at the provider level. To serve a cache hit, the provider holds a representation of your prompt for the cache lifetime, which can be up to 24 hours.
AI Gateway doesn't count this short-lived cache as retaining data, so ZDR requests can use models that cache prompts. If your definition of zero data retention rules out cached data, review the provider's policy for where it holds cached data and for how long.
The following providers currently offer ZDR on AI Gateway. Please review each provider's ZDR policy and terms carefully. A provider's default policy may not match with the status that AI Gateway has in place due to negotiated agreements. We are constantly coordinating and revising agreements to be able to enforce stricter retention policies for customers. The full terms of service are available for each provider on the model pages.
The table also shows whether each provider disallows prompt training, which is a separate control from ZDR.
A checkmark in the ZDR column means the provider offers ZDR on AI Gateway. It may still exclude specific models, tools, or request types. See What ZDR covers for how AI Gateway handles each exclusion, and review the provider's policy in the table for the details.
| Provider | No prompt training | ZDR | Policy | Notes |
|---|---|---|---|---|
| Alibaba Cloud | ✓ | ✓ | Custom policy | — |
| Anthropic* | ✓ | ✓ | ZDR policy | Claude Fable models are not ZDR. Anthropic retains prompts and outputs for 30 days. Excludes the code execution tool and programmatic tool calling. Container data is kept for up to 30 days. Excludes the MCP connector and Agent Skills. Excludes dynamic filtering for web search and web fetch. |
| Azure | ✓ | ✓ | Data privacy | — |
| Baseten | ✓ | ✓ | Security | — |
| Bedrock* | ✓ | ✓ | Data protection | — |
| Claude Platform on AWS | ✓ | ✓ | ZDR policy | Excludes the code execution tool, programmatic tool calling, the MCP connector, and Agent Skills. Excludes dynamic filtering for web search and web fetch. |
| DigitalOcean | ✓ | ✓ | Data policy | — |
| Exa | ✓ | ✓ | Custom Policy | Covers the Exa search tool: Exa's own web crawl and search index are outside ZDR. |
| Fireworks | ✓ | ✓ | Data handling | — |
| Google Vertex AI* | ✓ | ✓ | ZDR policy | — |
| Groq | ✓ | ✓ | ZDR policy | — |
| Meta | ✓ | ✓ | ZDR policy | Muse Spark contributor models are not ZDR. Meta may retain content where the law requires it or to address misuse. |
| Mistral | ✓ | ✓ | Terms of service | — |
| Modal | ✓ | ✓ | ZDR policy | — |
| Moonshot AI | ✓ | ✓ | Custom policy | — |
| Morph | ✓ | ✓ | ZDR policy | — |
| Nebius | ✓ | ✓ | Legal quick guide | — |
| OpenAI | ✓ | ✓ | ZDR with safety retention | Image, transcription, realtime, embedding, and speech models are not ZDR. OpenAI scans image and file inputs for CSAM and retains flagged images for manual review. Data sent to a remote MCP server follows that server's retention policy. |
| Parallel AI | ✓ | ✓ | Custom terms | Covers the Parallel search tool only. The Parallel Decisions model is not ZDR. |
| Parasail | ✓ | ✓ | Terms of service | — |
| Particle.AI | ✓ | ✓ | ZDR policy | — |
| Perplexity | ✓ | ✓ | ZDR policy | Covers the Perplexity search tool only. Sonar, embedding, and Decider models are not ZDR. |
| Relace | ✓ | ✓ | ZDR policy | — |
| Runware | ✓ | ✓ | ZDR policy | — |
| Together AI | ✓ | ✓ | Terms of service | — |
| TypeSafe AI | ✓ | ✓ | Legal policy | Except as necessary to comply with its legal obligations, TypeSafe shall not retain (a) prompts that are Customer Data for any longer than is necessary to generate Output for Customer and (b) Output for any longer than necessary to enable TypeSafe to fulfil its obligations to Customer under the Agreement. |
| Wafer | ✓ | ✓ | ZDR policy | — |
| xAI | ✓ | ✓ | ZDR policy | Grok Imagine video models are not ZDR. |
* Claude Fable models do not support ZDR on any provider, including Anthropic, Google Vertex, and Amazon Bedrock. Anthropic has determined this is required because some misuse patterns only become visible across cumulative requests. Prompts and completions are retained for 30 days and are not used to train Claude.
Vercel Token Pass models are served through the token-pass provider. Token Pass currently serves its models through Wafer and follows Wafer's zero data retention policy and terms.
A virtual model can restrict its traffic to zero-data-retention providers. The setting only tightens: either side can turn it on, and neither side can turn it off.
Was this helpful?