Data Retention
Store and access your full request and response data for debugging, analytics, and compliance.
LLM Gateway offers configurable data retention policies that allow you to store full request and response payloads. This enables powerful debugging capabilities, detailed analytics, and compliance with data governance requirements.
Retention Levels
LLM Gateway supports two retention levels that can be configured per organization:
| Level | Description | Storage Cost |
|---|---|---|
| Metadata Only | Stores request metadata (timestamps, models, token counts, costs, latency) without full payloads. Default. | Free |
| Retain All Data | Stores complete request and response payloads including messages, tool calls, and attachments. Enterprise only. | $0.01/1M tokens |
Metadata-only retention is enabled by default and provides usage analytics without additional storage costs.
Retain All Data is an Enterprise feature. New organizations default to Metadata Only and cannot enable Retain All Data unless they are on Enterprise. Existing non-Enterprise organizations that currently have Retain All Data enabled keep it until November 8, 2026, when the hosted platform (llmgateway.io) switches them to Metadata Only automatically; they can switch to Metadata Only earlier themselves. Self-hosted deployments are not switched automatically. Once off, Retain All Data cannot be turned back on without Enterprise.
Retention levels are configurable on standard (pay-as-you-go) organizations only. DevPass and chat subscriptions are always metadata only — their request and response payloads are not retained, and there is no setting to turn payload storage on. The Responses API exception below still applies to them.
Storage Pricing
When full data retention is enabled, storage is billed at $0.01 per 1 million tokens. This rate applies to:
- Input tokens (prompt)
- Cached input tokens
- Output tokens (completion)
- Reasoning tokens
Storage costs are calculated per request and billed separately from inference. When "Retain All Data" is enabled, each response's usage.cost_details object includes a data_storage_cost field with the per-request storage cost in USD. See Cost Breakdown for the full list of cost fields.
Example Cost Calculation
For a request with:
- 1,000 input tokens
- 500 output tokens
- 1,500 total tokens
Storage cost = 1,500 / 1,000,000 × $0.01 = $0.000015
Configuring Retention
Data retention is configured at the organization level in your dashboard settings. The setting is only available on standard pay-as-you-go organizations, and enabling Retain All Data requires an Enterprise plan:
- Navigate to Organization Settings → Policies
- Select your preferred Data Retention Level
- Save changes
Only organization owners can change the retention level — admins and project admins receive a 403.
Changing retention settings applies to new requests only. Existing stored data follows the retention period active when it was created.
Retention Periods
Data is retained for 30 days for all users, regardless of plan. After the retention period expires, the stored payloads (prompts, completions, tool payloads, raw request and response bodies) are automatically cleared; request metadata used for analytics is kept. Payloads already stored by a non-Enterprise organization during the transition window follow the same 30-day period after it switches to Metadata Only.
The Responses API does not require data retention. Stored responses (used for
previous_response_id chaining and GET /v1/responses/:id) are kept in
dedicated storage for 30 days — matching OpenAI's own retention — regardless
of your organization's data retention policy, and are not billed as data
storage. Because this is independent of the retention level, it applies to
metadata-only organizations, including DevPass and chat, whose Responses API
input and output items are therefore held for up to 30 days. Send store: false with the request to opt out. When an Enterprise organization's
zero-data-retention policy is active, the gateway
rejects Responses API requests unless store: false is set, does not retain
compaction state, bypasses the gateway response cache, strips provider
prompt-cache markers, and prevents payload retention or project response
caching from being enabled until ZDR is disabled. ZDR cannot be enabled until
both settings are off. These configuration prerequisites apply to
organization-wide ZDR. A key-level ZDR policy instead forces metadata-only
logging and disables caching only for requests through that key, without
changing other keys or organization settings.
Batch API input, output, and error files are kept for 30
days, or until you delete them, regardless of your organization's data
retention policy, and are not billed as data storage. The requests a batch
runs are logged under your retention level like any other request. While zero
data retention is active, the Batch API rejects uploads and new batches with
zdr_storage_conflict.
Flagged Content
The gateway content filter keeps an encrypted copy of requests its deciding classifier flags for abuse categories LLM Gateway chooses to review (for example child safety, sexual content, or cyber abuse), whether or not the request was blocked. This happens on every plan except Enterprise (unless the Enterprise agreement provides for it) and independently of the retention level, so it also applies to Metadata Only, DevPass, and chat organizations.
- What is kept: the request's messages and tool calls, and image URLs without credentials, query string, or fragment (plus a hash of the full URL). Inline images, audio, and files, including media blocks, data URLs, and long base64 data inside tool calls and results, are reduced to a SHA-256 hash, type, size, and file name; their bytes are never stored. Conversations over about 1 MB are trimmed, oldest messages first.
- How long: generally 90 days, then deleted automatically. A request reported to NCMEC is kept for one year after the report, as U.S. law requires. A copy can be kept longer where the law requires it or to investigate abuse; see Section 6 of the Terms of Use.
- Who can see it: only authorized LLM Gateway staff with full administrative access. Copies are encrypted at the application level, never appear in your request logs or exports, and every access is recorded in an internal audit log.
- Zero data retention: while a ZDR policy is active, only requests flagged for child safety are kept.
Self-hosted deployments choose the preserved categories in the admin content filter settings, delete expired copies in the worker's retention loop whether or not ENABLE_DATA_RETENTION_CLEANUP is set, and can turn preservation off in the admin content filter settings.
Accessing Stored Data
When Retain All Data is enabled (Enterprise), you can access your stored requests through the dashboard:
- View request history with full payload inspection
- Filter by model and date range
- Inspect complete request and response payloads
Use Cases
Debugging
Full data retention (Enterprise) enables you to:
- Inspect exact prompts sent to models
- Review complete responses including tool calls
- Trace conversation histories
- Identify issues in production
Analytics
With stored payloads, you can:
- Analyze prompt patterns and effectiveness
- Track response quality over time
- Build custom dashboards and reports
- Measure model performance across use cases
Compliance
Data retention helps meet compliance requirements by:
- Maintaining audit trails of AI interactions
- Enabling data governance policies
- Supporting incident investigation
- Providing records for regulatory requirements
Billing Considerations
Credit Usage
In API keys mode (using your own provider keys):
- Only storage costs are deducted from LLM Gateway credits
- Inference costs are billed directly to your provider
In credits mode:
- Both inference and storage costs are deducted from credits
Monitoring Storage Costs
Storage costs appear in:
- Usage dashboard under "Storage" category
- Billing invoices as a separate line item
Enable auto top-up in billing settings to ensure uninterrupted service when storage costs accumulate.
Self-Hosted Deployments
Self-hosted deployments have full control over data retention:
- Enable or disable the 30-day cleanup job with
ENABLE_DATA_RETENTION_CLEANUP=true(disabled by default; the period itself is not configurable) - Data is stored in your own PostgreSQL database
- No additional storage costs (you manage your own infrastructure)
Privacy and Security
- All stored data is encrypted at rest
- Access is restricted to organization members with appropriate permissions
- Stored payloads are automatically cleared after the retention period (on self-hosted deployments, only when the cleanup job is enabled via
ENABLE_DATA_RETENTION_CLEANUP=true) - You can request immediate deletion of specific records through support
How is this guide?
Last updated on