Skip to main content
DocumentationDevelopers

Errors and retries

Every error has a status and a stable code. This page explains how to read them and which ones to retry.

Documentation menu

The shape of an error

Errors come as JSON with an error object. Most answer in the platform's shape; audio, images, decisions and some inference errors answer in OpenAI's. Both carry a code: branch on it, never on the message.

{
  "error": {
    "code": "model-not-found",
    "category": "client",
    "message": "no active deployment serves this model for the operation",
    "request_id": "01K7YQ4D8M2P6S9V3X5Z7B1C4F"
  }
}

Statuses

StatusTypical codesWhat to do
400invalid-requestFix the request; do not retry it unchanged.
401api-key-invalid, api-key-unknown, api-key-revokedCheck the key and the region. See Authentication.
402payment-required, credits-exhaustedSubscribe, or top up the credits of additional models.
403policy-denied, team-not-selectableThe key's owner lacks the permission, or send X-Team-Id.
404model-not-foundThe model does not serve this endpoint, or is not yours: check GET /v1/models.
413request-body-too-largeJSON bodies up to 8 MiB, audio uploads up to 25 MiB.
429rate-limit-exceeded, *-concurrency-exceeded, provider-rate-limitedRetry with backoff, or send fewer requests at once.
500internal-errorRetry once; if it persists, contact support with the request id.
502forwarder-failedThe model answered something invalid. Retry with backoff.
503provider-unavailableNo healthy model right now. Retry with backoff.
503model-not-pricedThe additional model has no price yet. Do not retry; contact support.
504provider-timeoutThe model did not answer in time. Retry, or shorten the request.

Retry with backoff

Retry only 429, 503 provider-unavailable and 504, waiting longer each time. The official OpenAI clients already retry twice on their own (max_retries); this is a longer policy for batch jobs:

import random
import time

from openai import APIStatusError, OpenAI

RETRYABLE = {429, 503, 504}

def create_with_retries(client: OpenAI, attempts: int = 5, **request):
    """Retries only what can succeed later: limits, an unavailable or slow model."""
    for attempt in range(attempts):
        try:
            return client.chat.completions.create(**request)
        except APIStatusError as error:
            if error.status_code not in RETRYABLE or attempt == attempts - 1:
                raise
            time.sleep(min(30, 2**attempt) + random.random())  # exponential backoff with jitter

Request ids

Every answer carries an X-Request-ID header. Send your own (a ULID) to tie a request to your logs, or read the one the platform minted. Quote it when you contact support, and find the request with it in the request log.

curl
curl -i "$CCSIO_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $CCSIO_API_KEY" \
  -H "X-Request-ID: 01K7YQ4D8M2P6S9V3X5Z7B1C4F" \
  -H "X-Session-Id: support-ticket-4312" \
  -H "Content-Type: application/json" \
  -d '{"model": "qwen3.8-flash-next", "messages": [{"role": "user", "content": "Hi"}]}'
# HTTP/2 200
# x-request-id: 01K7YQ4D8M2P6S9V3X5Z7B1C4F
Explore the platform

Get your first API key

Registration is open. Four steps to your first call: create your account, create your organization, create your API key, and start using it.

  1. 01Create your account
  2. 02Create your organization
  3. 03Create your API key
  4. 04Start using it