Rate limits and errors

Rate limits apply per API key. You can set a requests per minute limit and a tokens per minute limit on each key. A key with no limit set gets no x-ratelimit headers.

When you go over a limit, or when a model is at capacity right now, the API answers 429 at once and does not queue your request. Wait for the Retry-After header, then try again.

HeaderMeaning
x-ratelimit-limit-requestsRequests allowed per minute for your API key. Sent only when the key has a requests limit.
x-ratelimit-remaining-requestsRequests left in the current minute window. Sent only when the key has a requests limit.
x-ratelimit-reset-requestsTime until the requests window resets, such as 42s.
x-ratelimit-limit-tokensTokens allowed per minute for your API key. Sent only when the key has a tokens limit.
x-ratelimit-remaining-tokensTokens left in the current minute window. Sent only when the key has a tokens limit.
x-ratelimit-reset-tokensTime until the tokens window resets, such as 42s.
x-clod-fallbackSet when your request was served by a fallback model. The value names it.
x-clod-cachehit or miss, when Cache identical responses is on for the project.
x-clod-api-versionRequest header. Send 1 to get the older response shape on /v1/chat/completions and /v1/models.
retry-afterOn 429 and 503: seconds to wait before you retry.

Errors use the OpenAI format. 400 is a bad request, 401 a bad key, 402 no credit, 404 an unknown model or object, 429 a rate limit or a model at capacity, and 5xx a problem on our side. On 429 and 5xx, wait for retry-after and try again.

{
  "error": {
    "message": "clod/kimi-k3p1-pro is at capacity right now, retry shortly",
    "type": "rate_limit_error",
    "code": "model_at_capacity"
  }
}

If you still depend on the older response shape (503 instead of 429 at capacity), send the header x-clod-api-version: 1.

curl https://api.clod.io/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-clod-api-version: 1" \
  -H "Content-Type: application/json" \
  -d '{"model": "MODEL_NAME", "messages": [{"role": "user", "content": "Say hello."}]}'