Skip to main content
Set an expiry to have Baseten delete a checkpoint after a set time. A checkpoint without one uses your organization’s default expiry, if it has one, and otherwise stays until you delete it.
Baseten permanently deletes an expired checkpoint within 24 hours. If the checkpoint is in use when it expires, such as by a deployment, Baseten deletes it within 24 hours after that use stops.
The Python SDK and the curl examples authenticate with BASETEN_API_KEY. Export your API key first:

Set an expiry when you save

In your training loop, pass ttl_seconds to save_state() or save_weights_for_sampler(): the number of seconds that Baseten keeps the checkpoint, from 3600 (1 hour) to 315360000 (10 years). To keep the training state for 7 days and print when it expires, add these lines to the loop:
The printed expires_at is about 7 days from now.

Change or remove an expiry

A change counts ttl_seconds from now, over the same 3600 to 315360000 range. Pass ttl_seconds=None, or "ttl_seconds": null in the request body, to remove the expiry so the checkpoint never expires.
To change a checkpoint’s expiry:Call set_checkpoint_ttl_from_path() on a ServiceClient with the checkpoint’s bt:// path. To keep the checkpoint for 30 days from now, replace <checkpoint_path> and run:
The call returns the updated checkpoint, and the printed expires_at is about 30 days from now.

Next steps