Browse documentation

Reference · Launch preview. EvaEsi has not launched.

Error Codes

All public API errors return a consistent envelope and an HTTP status code suitable for automated handling.

On this page

Error response format#

JSONError response format
{
  "error": {
    "code": "INVALID_API_KEY",
    "message": "API key not found or has been revoked."
  }
}

Status codes#

HTTPCodeDescription
401MISSING_API_KEYMissing bearer header.
401INVALID_API_KEYInvalid, expired, or revoked key.
400API_KEY_ERROROther API-key validation failure.
403INSUFFICIENT_SCOPEKey scope does not allow the route.
403INSUFFICIENT_TIERNo prepaid credit or Developer plan to draw on.
429RATE_LIMITEDThe room's one request at a time, or the key's or room's limit, exceeded.
503RATE_LIMIT_UNAVAILABLEThe local rate limiter could not be queried.
400EMPTY_PROMPTPrompt missing.
400PROMPT_TOO_LARGEPrompt exceeds 100,000 bytes.
400INVALID_MODELUnknown level.
400MODEL_UNAVAILABLEThe level is not available in this room at present.
400INVALID_REQUESTMalformed request rejected by the inference gateway.
402BUDGET_EXCEEDEDThe room's spend limit, or your credit, would be exceeded by the request.
404NOT_FOUNDRequested upstream object was not found.
404SOURCES_NOT_FOUNDNo live sources retained for that request ID.
413PAYLOAD_TOO_LARGEUpstream payload exceeded the accepted size limit.
422SAFETY_BLOCKEDGateway safety pre-screen blocked the request.
429INFERENCE_RATE_LIMITEDUpstream inference service throttled the request.
503EVA_UNAVAILABLEInference service unavailable.
401INFERENCE_UNAUTHORIZEDGateway credentials were rejected upstream.
503INFERENCE_BUSYInference backend reported temporary saturation.
500DB_ERRORUsage or billing query failed.
500SERVER_MISCONFIGUREDAPI key verification is not configured correctly.
502INFERENCE_ERRORGateway or upstream dispatch failure.
503DB_UNAVAILABLERequired database services are unavailable.

Retry guidance#

429: rate limited

When request limits are exceeded, the API returns retry-after: 60, x-ratelimit-limit, and x-ratelimit-remaining: 0. Respect those headers instead of retrying immediately.

400/402: contract or budget errors

Do not retry unchanged requests that fail with validation, model-selection, or budget-cap errors. Fix the payload, switch model, lower max_output_rungs, or adjust the project budget first.

500/502/503: service errors

Retry with bounded exponential backoff. If the failure persists, stop retrying and inspect upstream availability, database health, workspace budget state, and current platform status.

Example error handling (Python)#

PythonExample error handling (Python)
import requests
import time

def call_eva(prompt, retries=3):
    for attempt in range(retries):
        response = requests.post(
            "https://evaesi.dev/api/v1/responses",
            headers={"Authorization": "Bearer esi_dev_YOUR_KEY"},
            json={"prompt": prompt, "level": "focus"},
        )

        if response.status_code == 200:
            return response.json()

        if response.status_code == 429:
            wait = int(response.headers.get("retry-after", 60))
            time.sleep(wait)
            continue

        if response.status_code >= 500:
            time.sleep(2 ** attempt)
            continue

        error = response.json()
        raise Exception(f"{response.status_code}: {error['error']['message']}")

    raise Exception("Max retries exceeded")