Errors and limits

SrotGateway API error codes, rate limits (60 requests a minute per key, 5 calls at once) and how to retry.

View as Markdown

Errors follow OpenAI's format:

{"error": {"message": "Your balance is ₹0. Please top up to continue.", "type": "insufficient_quota", "code": "insufficient_balance", "param": null}}

Limits

Limit Default Notes
Requests per minute, per key 60 Change it per key on the API keys page (1–600).
Calls running at once, per account 5 Across all your keys. Write to contact@chrombyte.com if you need more.
Total time for one call None A call ends only after 5 minutes with no output at all.
Request size 32 MB

Error codes

HTTP code What it means What to do
400 invalid_json, invalid_messages The request body is wrong. Send JSON with a non-empty messages array.
401 missing_api_key, invalid_api_key No key, or the key is wrong or deleted. Send Authorization: Bearer sg-....
402 insufficient_balance Your balance is ₹0. Top up.
403 account_blocked The account is blocked. Write to contact@chrombyte.com.
404 model_not_found Unknown model ID. Check GET /v1/models.
413 request_too_large Body is over 32 MB. Send less text.
429 rate_limit_exceeded Over the key's requests per minute. Wait the seconds in the Retry-After header.
429 concurrency_limit 5 calls already running. Wait for one to finish.
429 busy All model slots are in use. Retry in 2–5 seconds.
503 model_busy The model is overloaded. Retry in a few seconds.
502 upstream_error, empty_reply, upstream_unavailable The model failed. Retry; if it keeps failing, try another model.
504 idle_timeout, upstream_unreachable No reply in time. Retry, and use streaming.

You are not charged for calls that fail before the model answers.

Busy errors are retried for you

When the model says it is busy, SrotGateway waits and retries a few times before giving up, so most busy moments never reach you. If you still get 429 or 503, retry with a short wait that grows each time, for example 2, 4 then 8 seconds.

import time
from openai import OpenAI, RateLimitError, InternalServerError

client = OpenAI(base_url="https://api.srotgateway.in/v1", api_key="sg-...")
for attempt in range(4):
    try:
        reply = client.chat.completions.create(model="deepseek-v4.1-flash-fast", messages=[{"role": "user", "content": "Hi"}])
        break
    except (RateLimitError, InternalServerError):
        time.sleep(2 ** (attempt + 1))