Skip to content
Ruvicode logo
Ruvicode
USD

Error Handling

Ruvicode API error codes and error handling. Learn how to retry on rate limits, handle insufficient balance, and parse OpenAI-format error responses.

Ruvicode returns standard HTTP status codes. Error responses follow the OpenAI format.

Error format

{
  "error": {
    "message": "Human-readable error message",
    "type": "error_type"
  }
}

Common errors

StatusTypeMeaningAction
400invalid_request_errorBad request parametersCheck your request body
400content_policy_violationImage request rejected by the content policy (nothing is charged)Change the prompt or the input image
401authentication_errorInvalid, missing, or revoked API keyCheck your Authorization header or key status
402insufficient_balanceWallet balance or spend limitTop up your wallet or raise the key's spend limit
403invalid_request_errorModel not allowed for this keyAdd the model to the key's allowed models, or use another key
404invalid_request_errorModel not foundThe model id does not exist, check the id against /v1/models
429rate_limit_errorRate limit exceededWait and retry, or reduce frequency
500api_errorServer errorRetry with backoff
503api_errorModel temporarily unavailableRetry, or switch models

The 403 vs 404 split is deliberate: 404 means the model id does not exist at all, 403 means it exists but the key you used is not allowed to call it. A scoped-out request never reaches a model, so it costs nothing.

Rate limiting

Rate limiting works in two layers, both a sliding 60-second window. Each key has its own limit (default 100, up to 700), and all keys in your account share one account-wide budget of 700 requests per minute, so creating more keys does not add capacity. When exceeded:

{
  "error": {
    "message": "Rate limit exceeded. Retry after 60 seconds.",
    "type": "rate_limit_error"
  }
}

When the account-wide budget is the one hit, the message says so explicitly:

{
  "error": {
    "message": "Account rate limit exceeded. All of your keys share one requests-per-minute budget. Retry after 60 seconds.",
    "type": "rate_limit_error"
  }
}

Response headers include rate limit info:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
Retry-After: 60

Agentic tools bursting many parallel requests should keep the limit in mind, denied requests still count against the window for the next 60 seconds.

Retry strategy

For 429 and 503 errors, use exponential backoff. Image requests take longer (usually 5 to 30 seconds), so give image calls a client timeout of at least 2 minutes:

import time
 
def retry_with_backoff(fn, max_retries=3):
    for attempt in range(max_retries):
        try:
            return fn()
        except Exception as e:
            if attempt == max_retries - 1:
                raise
            time.sleep(2 ** attempt)  # 1s, 2s, 4s

Insufficient balance

If your wallet runs out mid-session, you'll receive a 402 error. Top up your wallet to resume. Your existing API keys remain valid, no need to regenerate them. Spend limits work the same way: raising or removing the limit on the key in the dashboard takes effect immediately.