Errors
SpiderGate uses conventional HTTP status codes and an OpenAI-style error object. Because the gateway already fails over across providers, a sustained error usually points at your request or account β not a single provider being down.
Error object
{
"error": {
"type": "invalid_request_error",
"code": "model_not_found",
"message": "Unknown model or alias: 'spideriq/fastt'"
}
}Status codes
Code |
| When | Resolution |
|---|---|---|---|
|
| Malformed body β e.g. missing | Check the request against Chat Completions; |
|
| Missing / malformed / rotated key | Send |
|
| Out of credit, or | Top up credit, or raise |
|
|
| Use a valid alias (Task Aliases) or id (Models). |
|
| Too many requests for your key's quota | Exponential backoff + retry. Persistent 429 = your quota, since SpiderGate already load-balances providers. |
|
| Transient gateway fault | Retry with backoff; if it persists, check the status page. |
|
| Every model in the alias chain failed | Retry; widen the chain with |
Handling pattern
from openai import OpenAI, APIStatusError
client = OpenAI(api_key=os.environ["SPIDERGATE_API_KEY"],
base_url="https://spideriq.ai/api/gate/v1")
try:
resp = client.chat.completions.create(model="spideriq/fast", messages=msgs)
except APIStatusError as e:
if e.status_code == 429:
backoff_and_retry() # transient
elif e.status_code == 402:
raise RuntimeError("Top up SpiderGate credit") # not retryable
else:
raiseRetry 429 / 500 / 502 with backoff. Never retry 400 / 401 / 402 / 404 β fix the request or account first.