How to rotate an AI provider key without interrupting workers

Create a replacement with the same required permissions, exercise it in staging, then roll it out to workers in a controlled order. Retire the old credential after verifying that active workloads use the new one.

Example

A queue has eight workers and two are handling long jobs. Switch a small cohort first, check successful calls, then refresh the remaining workers before revoking the old key.

What to do

  1. Identify each process or secret store that reads the credential. Check how long running workers cache it and whether the provider allows overlap.
  2. Test the replacement with a synthetic request using the intended model and workspace. Roll it out in batches and monitor authentication failures.
  3. Wait for old workers to finish or reload. Check that the old credential is unused, then retire it and record the new owner and rotation date.

How to verify

Staging and production request records show successful calls on the intended credential version without revealing its value.

Limits

An exposed key may need immediate revocation. Follow incident procedures when maintaining overlap would extend exposure.

Spendplane for this workflow

Open the API gateway quickstart

Related reading