---
title: How to control AI provider data handling with AI Gateway
description: Prevent AI providers from training on your prompts, enforce zero data retention, and restrict providers and models with Vercel AI Gateway.
url: "https://vercel.com/kb/guide/control-ai-provider-data"
published: 2026-10-15
last_updated: 2026-10-15
authors: Anshuman Bhardwaj
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

Use [Vercel AI Gateway](https://vercel.com/docs/ai-gateway/security-and-compliance) to restrict which providers and models receive your requests and enforce provider training and retention requirements. You control what enters each prompt and what your application logs. Review provider-specific exceptions before sending sensitive data.

## Start with the data you need to protect

Before choosing a model, identify what your AI feature needs to process. An internal support assistant may need the customer's problem description, product version, and relevant troubleshooting instructions.

The full ticket can also contain names, email addresses, account identifiers, attachments, or credentials pasted into error reports.

Send the information needed to answer the question. For a connection timeout, include the error and product version. Leave out unrelated details, such as the customer’s billing address.

Review internal documents before adding them to a prompt. Remove proprietary procedures, infrastructure details, or secrets that the assistant doesn't need.

Define a policy for the feature before implementation:

- Record permitted data categories, approved providers and models, and training and retention requirements.
  
- Define what the application should do when no approved route is available.
  
- Assign an owner to review the policy when the app or provider catalog changes.
  

## Trace where request data goes

Requests typically follow this path:

**User > application > AI Gateway > inference provider > application**

Your application constructs the prompt. AI Gateway selects an eligible provider, forwards the inference request, and returns the response.

Retrieval can add documents from a database, and tools can fetch records or call external services. Application logs, stored conversations, and telemetry can retain additional copies of request data.

Check three requirements at each destination:

| Question                           | What to establish                                                                       |
| ---------------------------------- | --------------------------------------------------------------------------------------- |
| Can the data be used for training? | Whether the agreement allows the service to use your content to train or improve models |
| Is the data retained?              | What is stored, why, for how long, and under which exceptions                           |
| Where is it processed or stored?   | Whether those locations meet your workload’s requirements                               |

### No training doesn’t mean no retention

Providers can prohibit training while retaining content for a feature or safety review. [Anthropic's retention policy](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention) defines which API features and models qualify for zero data retention (ZDR).

Review the model, serving provider, API feature, and credentials together. The organization hosting inference may differ from the model’s creator. Consumer chat settings do not determine the terms for your application’s API requests.

## Prevent training and enforce zero data retention

Under its [security and compliance policy](https://vercel.com/docs/ai-gateway/security-and-compliance), AI Gateway permanently deletes prompts and responses after requests complete. Configure provider-level routing controls to enforce training and retention requirements for upstream providers.

Configure AI Gateway’s [training and ZDR controls](https://vercel.com/changelog/zero-data-retention-no-prompt-training-on-ai-gateway) for your workload:

- **Prevent prompt training:** [`disallowPromptTraining: true`](https://vercel.com/docs/ai-gateway/security-and-compliance/disallow-prompt-training) limits requests using AI Gateway system credentials to providers with no-training agreements. Your own provider keys follow your provider agreement and settings.
  
- **Require zero data retention:** Set [`zeroDataRetention: true`](https://vercel.com/docs/ai-gateway/security-and-compliance/zdr) to require providers covered by ZDR agreements.
  

ZDR includes no-training controls, so you don't need to enable both.

> Per-request no-training controls add no cost on any plan. ZDR requires Pro or Enterprise.
> 
> Per-request ZDR has no additional charge; [team-wide ZDR](https://vercel.com/docs/ai-gateway/security-and-compliance/zdr#pricing) adds a charge for successful responses that return usage data.

Require ZDR for every support assistant request. To [enable it team-wide](https://vercel.com/docs/ai-gateway/security-and-compliance/zdr), open **AI Gateway > Settings** in the Vercel dashboard and enable **Zero Data Retention**. You can also enforce ZDR on individual requests in code.

ZDR applies when either the team setting or the request enables it, so individual requests cannot override team-wide enforcement. AI Gateway returns an error if no eligible route remains after considering fallback providers.

Review the selected provider’s ZDR policy for model and feature exceptions, including prompt caching. AI Gateway can accept requests that use features excluded from that policy. Prevent your application from using those features when your workload requires no retention.

Before using this server-side example, install AI SDK 7 and configure `AI_GATEWAY_API_KEY` using the [AI Gateway text-generation quickstart](https://vercel.com/docs/ai-gateway/getting-started/text).

Require ZDR and omit prompts and responses from SDK telemetry:

```javascript
import { generateText } from 'ai';

const model = process.env.SUPPORT_AI_MODEL;

if (!model) {
  throw new Error('Configure an approved support model.');
}

const result = await generateText({
  model,
  instructions: 'Summarize the issue and suggest a troubleshooting step.',
  prompt: 'The desktop client times out after 30 seconds.',
  providerOptions: {
    gateway: {
      zeroDataRetention: true,
    },
  },
  telemetry: {
    recordInputs: false,
    recordOutputs: false,
  },
});
```

Set `SUPPORT_AI_MODEL` to an approved AI Gateway model ID with an eligible route.

Handle unavailable approved providers as an expected error. Offer manual support or retry another approved route with the same restrictions. Keep those restrictions in place in every error handler.

### Review agreements for your own provider keys

Bring your own key (BYOK) requests operate under your provider agreement. Under AI Gateway’s [BYOK and ZDR rules](https://vercel.com/docs/ai-gateway/security-and-compliance/zdr#byok), AI Gateway skips those keys when ZDR is required unless you mark them as ZDR-compliant.

Confirm that your provider agreement covers ZDR before marking a key as compliant. Marking the key makes it eligible for ZDR routing; you still need to enable ZDR for the team or request. Record who reviewed the agreement and which workloads it covers.

## Limit which providers and models can serve requests

Security teams may review contractual terms, hosting arrangements, incident processes, and suitability for the data alongside retention.

AI Gateway provides separate controls for providers and models:

| Control                                                                                                 | Purpose                                                    |
| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| [Provider allowlist](https://vercel.com/docs/ai-gateway/security-and-compliance/provider-allowlist)     | Restricts which inference providers may serve team traffic |
| [Model allowlist](https://vercel.com/docs/ai-gateway/security-and-compliance/model-allowlist)           | Restricts which models the team may use                    |
| [Request-level](https://vercel.com/docs/ai-gateway/models-and-providers/provider-options) `only` filter | Further narrows the providers for an individual request    |

> Team owners can configure provider and model allowlists on Pro and Enterprise plans, excluding Pro trials. Requests must satisfy both enabled allowlists, including BYOK requests.
> 
> Using either or both allowlists incurs a [single surcharge per successful request](https://vercel.com/docs/ai-gateway/security-and-compliance/model-allowlist#pricing).

Enable the allowlists in **AI Gateway > Settings** and disable unapproved providers and models. All existing entries start enabled to preserve current traffic when you turn on an allowlist.

Newly added providers and models start disabled. Changes can take a couple of minutes to propagate; wait before testing.

Approve the serving provider and model separately. Blocking one provider does not necessarily block a model that another allowed provider can serve.

To narrow routing for a workload, add an `only` list to the [AI Gateway provider options](https://vercel.com/docs/ai-gateway/models-and-providers/provider-options). Providers must appear in both that list and the team’s provider allowlist. An `order` list sets preferences but can leave other providers available as fallbacks. Use `only` to restrict destinations.

Keep the support assistant's model choice in server-side configuration. Map any user-selectable options to approved model IDs and fallback configurations.

These controls apply to requests routed through AI Gateway. Review direct provider integrations, background jobs, and external tools separately, and apply the same data-handling requirements to those paths.

### Review data location requirements

ZDR does not determine data location. Where supported, [AI Gateway regional inference](https://vercel.com/docs/ai-gateway/security-and-compliance/regional-inference) lets you choose the provider's inference region and configures any storage of request data in the same region. Requests fail when the selected region cannot be honored.

Provider policies can make exceptions for abuse or safety reviews, including retaining flagged requests outside the selected region. Check those terms before relying on regional routing for residency requirements.

This setting does not restrict AI Gateway processing to the selected region. AI Gateway may receive and process the request in another Vercel region before forwarding it to the provider.

Evaluate the complete path when a workload has residency requirements, including application storage, retrieval, tools, and telemetry exports.

## Test your implementation

Verify which routes served your requests and which restrictions applied. Use routing metadata to document enforcement without retaining conversation content.

Use [AI Gateway request logs](https://vercel.com/docs/ai-gateway/observability-and-spend/logs) to inspect the serving model and provider, authentication source, ZDR status, and routing attempts. Open a request to check for failover and see which credentials served each attempt. Export the evidence you need before the routing attempt details expire after 30 days.

On Pro and Enterprise, [AI Gateway Trace Drains](https://vercel.com/docs/ai-gateway/observability-and-spend/trace-drains) send request metadata to an OpenTelemetry Protocol over HTTP (OTLP/HTTP) endpoint. Traces omit prompt and completion content. Delivery and data transfer incur usage charges.

[AI SDK 7 telemetry](https://ai-sdk.dev/docs/ai-sdk-core/telemetry) events include inputs and outputs by default. Data reaches your observability tools through registered or per-call integrations; Node.js tracing-channel subscribers can receive events too.

The earlier example excludes content with `recordInputs: false` and `recordOutputs: false`. To turn off all telemetry events for a call, including tracing-channel events, set `telemetry: { isEnabled: false }`.

```typescript
const result = await generateText({
  // ...
  telemetry: {
    isEnabled: false,
  },
});
```

Review custom logs, error handlers, and reporting metadata for ticket content recorded outside the SDK controls. Use request IDs and non-sensitive operational labels to investigate failures.

Before release, test with synthetic data:

1. Confirm an approved model succeeds through an approved, eligible provider.
   
2. Confirm that an unapproved model is blocked.
   
3. Confirm that a request restricted to an unapproved provider is blocked.
   
4. Confirm that a request with no eligible route fails without relaxing policy.
   
5. Check that application logs and telemetry omit ticket content.
   

Review routing evidence for successful requests and recovery paths. Receiving a successful response does not establish which controls were applied.

## Next steps

After release, revisit approved providers and models whenever the application, provider catalog, or agreements change. Check routing logs to confirm that requests still comply with your policy.

When data-handling requirements change, update retention settings for stored conversations and telemetry along with customer disclosures.

## FAQs

### How can I prevent AI providers from training on my data?

Set `disallowPromptTraining: true` in `providerOptions.gateway` to restrict requests using AI Gateway system credentials to providers with no-training agreements. The filter does not apply to BYOK requests, which follow your provider agreement and settings.

### What is the difference between zero data retention and no training?

No-training policies prohibit using your content to train models. Zero data retention limits the storage of prompts and responses after processing, subject to provider-specific terms and exceptions. Check both requirements because a no-training policy can still allow retention.

### Does Vercel AI Gateway store prompts and responses?

No. Under its [documented data-handling policy](https://vercel.com/docs/ai-gateway/security-and-compliance), AI Gateway deletes prompts and responses after requests complete. Enable [provider-level ZDR](https://vercel.com/docs/ai-gateway/security-and-compliance/zdr) to restrict upstream routes, and apply separate retention controls to your application’s conversations, logs, and telemetry.

### How can I restrict which AI providers and models my application uses?

Configure AI Gateway’s [provider allowlist](https://vercel.com/docs/ai-gateway/security-and-compliance/provider-allowlist) and [model allowlist](https://vercel.com/docs/ai-gateway/security-and-compliance/model-allowlist), then disable unapproved entries. Requests must satisfy both enabled allowlists. These controls apply to traffic through AI Gateway, including BYOK requests.

### Does zero data retention apply when I use my own provider API keys?

Bring your own key (BYOK) requests can use ZDR routing if your provider agreement covers ZDR and you mark the key as compliant. Under AI Gateway’s [BYOK rules](https://vercel.com/docs/ai-gateway/security-and-compliance/zdr#byok), unmarked keys are skipped when ZDR is required. Marking a key does not enable ZDR; enable it for the team or request.

### What happens if no eligible provider is available?

AI Gateway returns an error when no eligible provider can serve the selected model under its [ZDR rules](https://vercel.com/docs/ai-gateway/security-and-compliance/zdr). Keep the restriction in place and offer another approved route or manual support.

## More AI Gateway guides

- [Build an AI Chat Agent with Weather API Tool Calling](/kb/guide/build-ai-agent-weather-api): Build an intelligent conversational agent that fetches real-time weather data using the AI SDK, tool calling, and a backend weather API powered by Express, FastAPI or Nitro
- [How to automatically approve tool calls in eve with Jev](/kb/guide/auto-approve-tool-calls-eve-jev): Use Jev to review tool calls in eve, allow routine actions, and request human approval when needed. Configure the policy and test its failure paths.
- [Private enterprise agents on Vercel](/kb/guide/private-enterprise-agents-vercel): Design private enterprise agents that call internal APIs and databases with Vercel Functions, Secure Compute, AI Gateway, Workflows, and Vercel Connect.