# Going to production

Use this checklist before sending production traffic. Each section links to
detailed guidance elsewhere in the documentation.

## Keys and secrets

- **One key per app and environment** (`prod-backend`, `staging`,
  `cli-tools`), and [private keys over workspace-shared
  ones](/authentication#keys) when usage should remain attributable to a
  person. There are no per-key rate limits.
- **Load keys from a secret manager or environment variable.** Never store
  them in source control. Add the `ck_` prefix to secret-scanning rules.
- **Document a [rotation procedure](/authentication#rotating-and-revoking).**
  Rotate shared credentials when access changes and immediately after
  suspected exposure.
- **Do not include a key in public client-side code.** Browser calls are
  [supported](/making-requests#calling-from-the-browser), but public
  JavaScript cannot keep a credential secret. Proxy requests through your
  backend. Preserve the API response status and `Retry-After` header in
  that proxy so callers can follow the [retry guidance](/errors#retries).

## Retries and timeouts

- **Retry `429`, `502`, and `503`** with exponential backoff and jitter,
  honoring `Retry-After` as the floor. Code in
  [Rate limits](/rate-limits#backing-off-well).
- **Never retry `400`, `401`, `404`, or `413` unchanged**. They fail
  identically every time. See [Errors](/errors#retries).
- **Treat `402` as terminal and alert on it.** An exhausted balance stops
  every key in the workspace; a retry loop [cannot fix it](/errors#402).
- **Set client timeouts based on your workload and latency objective.** Treat
  a timeout as transient and retry with backoff.
- **Retry any `5xx` by status, not by body.** See
  [Errors](/errors#error-envelope).

## Concurrency and throughput

- **Use a shared client-side concurrency limit** across workers. See
  [Rate limits](/rate-limits#backing-off-well).
- **Remember rate limits are shared by workspace and model.** All keys share the selected model's
  rate ceiling. Each model has its own ceiling, while every model draws from one workspace credit
  balance. Set separate concurrency budgets for batch and user-facing traffic.
- **Reuse connections.** Use connection pooling and keep-alive. OpenAI SDK
  clients enable these by default. See
  [Measuring latency](/measuring-latency#getting-the-numbers-down).

## Observability

- **Send `X-Client-Trace-Id` on every request.** Celeris echoes it in API
  responses so you can correlate failures with application logs and support
  cases. See the
  [API reference](/api-reference#request-headers).
- **Log or sample wall-clock duration and the `Server-Timing` header.** For
  complete responses, compare them to estimate client/network overhead. For
  streams, measure time to first token separately because `Server-Timing` ends
  at the earlier response-header boundary. See
  [Measuring latency](/measuring-latency).
- **Track your client-side `429` rate.** Throttled requests are not counted on
  the usage page, so track them in your application logs and metrics. See
  [Rate limits](/rate-limits#watching-your-usage).

## Billing readiness
- **Monitor spend.** The [usage page](/console#usage) shows completed request
  counts and token volumes over 24 hours, 7 days, or 30 days. Project spend from
  those volumes with the [pricing rates](/pricing#rates).
- **Maintain sufficient credit.** When the balance is exhausted, all keys in
  the workspace return [`402`](/errors#402). Alert on this response.

## Deployment geometry

- **Deploy callers close to their users.** Celeris aims to serve requests as
  close as possible to customers. Typical short requests complete in roughly
  50–150 ms within the serving region, and network distance adds to end-to-end
  latency.
- **Measure complete responses with `Server-Timing`.** Compare it with
  wall-clock latency to estimate client/network overhead. For streams, also
  measure time to first token and do not treat the header as model time. See
  [Measuring latency](/measuring-latency).

## The checklist
- [ ] Separate API keys per app and environment, loaded from a secret store
- [ ] Rotation procedure written down; keys rotate on departures/exposure
- [ ] No keys in public client-side code
- [ ] Backoff with jitter on `429`/`502`/`503`, honoring `Retry-After`
- [ ] `400`/`401`/`404`/`413` fail fast, no blind retries
- [ ] `402` alerts a human; nothing retry-loops on it
- [ ] Client timeouts set and timeout retries bounded
- [ ] Shared concurrency cap sized under your workspace's ceiling
- [ ] `X-Client-Trace-Id` sent on every request and logged
- [ ] Client-side `429` rate tracked
- [ ] Output budget set deliberately on every chat and Responses call (sized
      for the expected response)
- [ ] Callers deployed near their users; keep-alive connections
- [ ] Credit balance monitored; top-up owner named
