OpenAI Enterprise zero data retention
Quick answer
OpenAI Enterprise offers a zero data retention option that prevents your data from being stored or used for model training. To enable this, set the
data_usage parameter to none in your API requests or configure it in your Enterprise dashboard settings.PREREQUISITES
Python 3.8+OpenAI Enterprise API keypip install openai>=1.0
Setup
Install the official openai Python package and set your OpenAI Enterprise API key as an environment variable. This key must be provisioned with zero data retention enabled or configured accordingly in your Enterprise dashboard.
pip install openai>=1.0 output
Collecting openai Downloading openai-1.x.x-py3-none-any.whl (xx kB) Installing collected packages: openai Successfully installed openai-1.x.x
Step by step
Use the data_usage parameter set to none in your API call to ensure zero data retention. This disables logging and training on your data.
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello, ensure zero data retention."}],
data_usage="none"
)
print(response.choices[0].message.content) output
Hello! Your request was processed with zero data retention enabled.
Common variations
You can also configure zero data retention globally in the OpenAI Enterprise dashboard to apply to all API requests without specifying data_usage each time. For asynchronous calls, use the same parameter in async methods. Different models like gpt-4o-mini support this parameter similarly.
import os
import asyncio
from openai import OpenAI
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
async def main():
response = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Test zero data retention async."}],
data_usage="none"
)
print(response.choices[0].message.content)
asyncio.run(main()) output
Your async request was processed with zero data retention.
Troubleshooting
- If you receive errors about
data_usagebeing unrecognized, verify your API key is from an OpenAI Enterprise plan with zero data retention enabled. - If data retention is still occurring, check your Enterprise dashboard settings to confirm zero data retention is active globally or per request.
- Contact OpenAI Enterprise support if your configuration does not apply as expected.
Key Takeaways
- Set
data_usage="none"in API calls to enable zero data retention per request. - Configure zero data retention globally in the OpenAI Enterprise dashboard for convenience.
- Ensure your API key is provisioned for Enterprise zero data retention to avoid errors.
- Use the same parameter with async calls and across supported models like
gpt-4oandgpt-4o-mini.