Safeguard Docs
Safeguard AI SDKs

Rate and usage limits

How the Safeguard AI API limits requests per key, what a 429 with Retry-After means, and how the SDKs react.

Rate and usage limits

The Safeguard AI API limits how fast a key can call it.

  • Per key. Each key has a requests-per-minute limit. The default is 20 requests per minute per key.
  • Per address. A larger limit applies per calling address, before the key is checked.
  • Run capacity. A query is a Safeguard AI run. Runs count against the workspace's Safeguard AI run capacity, the same capacity the web app and the CLI use, and the API answers 429 RUN_LIMIT_REACHED when it is in use.

These values are service defaults and can change. Read the Retry-After header rather than hard-coding them.

When you are limited

A limited request is answered 429 with a Retry-After header in seconds, and the error code is RATE_LIMITED or RUN_LIMIT_REACHED. The SDKs read the header into retryAfter (retry_after in Python, RetryAfter in Go).

  • The SDKs wait and retry for you, up to maxRetries times, when the wait is within their limit. This is safe for queries because a limited request never started.
  • If it still fails, the error carries the wait. Sleep that long and try again, as in the helper on Errors and retries.
  • To stay under the limit in a batch job, send queries one after another, not in parallel, and keep one key per job so one job does not use another's allowance.

Usage

Queries made with a key appear in the owner's conversation history. Each use of a key is recorded for audit by Safeguard without the key itself. The API Platform's credits, spend limits and usage dashboards apply to the OpenAI-compatible inference API, not to these SDKs.

On this page