Skip to content

Preview: contracts not deployed on Elysium yet. Wallet connect works; no balances or transactions.

Cerebra
API reference

Errors and limits

Errors use the OpenAI error shape, so existing SDK error handling keeps working. Failed requests never charge your balance.

Error format

402 Payment Required
{
  "error": {
    "message": "Insufficient balance. Deposit CEREBRA to top up your API balance.",
    "type": "insufficient_quota",
    "code": "insufficient_balance",
    "balance": "0.000000"
  }
}

Match on error.code in code. error.message is for people and may change.

Status and error codes

StatusCodeTypeMeaning
400invalid_requestinvalid_request_errorBody is not valid JSON or is missing model or messages.
400invalid_max_costinvalid_request_errormax_cost is not a non-negative decimal amount in USD.
400invalid_address / invalid_epochinvalid_request_errorMalformed address or epoch in a key or account request.
401invalid_api_keyauthentication_errorKey missing, unknown, or revoked by a newer epoch.
401invalid_signatureauthentication_errorThe signature does not match the address and message.
402insufficient_balanceinsufficient_quotaBalance cannot cover even one output token. The body includes balance.
402max_cost_exceededinsufficient_quotamax_cost is too low to cover this prompt.
404model_not_foundnot_found_errorUnknown model id. List models with GET /v1/models.
409epoch_revokedinvalid_request_errorThat epoch was revoked. The current epoch is in the message.
429upstream_errorrate_limit_errorThe provider is rate limiting. Retry with backoff.
499client_closedinvalid_request_errorThe client closed the connection before the response.
502upstream_error / upstream_unreachableapi_errorThe provider failed or is unreachable. Nothing is charged.
503provider_unavailableapi_errorThe model's provider is not configured on this gateway.

Handling errors

from openai import OpenAI, APIStatusError

try:
    client.chat.completions.create(model="deepseek/deepseek-flash", messages=msgs)
except APIStatusError as e:
    code = e.body.get("code") if isinstance(e.body, dict) else None
    if code == "insufficient_balance":
        print("Top up your balance")
    elif e.status_code in (429, 502):
        pass  # retry with exponential backoff

Rate limits

The edge allows an average of 20 requests per second per IP address with bursts of up to 40. Requests over the limit receive 429 Too Many Requests without a JSON body. There is no per-key token limit: throughput is bounded by your balance and by the provider.

LimitValueNotes
Requests per IP20 per second, burst 40Enforced at the edge.
Output tokens per requestModel maximumDefaults to 8,192 when max_tokens is not set.
Spend per requestYour balance, or max_costWhichever is lower.

Retry guidance

Retry 429 and 5xx responses with exponential backoff and jitter. Do not retry 4xx errors other than 429.