Files
coder/docs/reference/api
Susana Ferreira dfe6402910 feat: add an AI Gateway data retention endpoint (#32659)
## Description

Pages that read raw AI Gateway data and have a date picker don't handle
data retention consistently. AI Sessions allows start dates whose data
is already purged. AI spend only learns the retention after a request.

The new AI spend page reads aggregated data, which is never purged, in
some views and raw data in others. For consistency, the Overview and
Detailed report tabs should accept the same date range, so both are
limited to the retention.

The retention is in the deployment config, but only Owners can read it.
This adds an experimental endpoint that returns only the retention, so
these pages can offer only retained dates.

## Changes

- Add `GET /api/experimental/ai-gateway/retention`, returning
`retention_ms`. Zero means data is never purged.
- Any authenticated user with the AI Gateway feature can read it, since
it holds no usage data.
- Add `codersdk.AIGatewayRetention` and the
`ExperimentalClient.AIGatewayRetention` method.

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-11-24 18:07:38 +00:00
..
…
…