Guides / Production
Production · about 8 min
Handle errors, rate limits and retries
What each status means, which ones to retry, and a client that does it for you.
Know which errors to retry
Status Meaning Do 400 / 422 The request is malformed or invalid; detaillists every problem with its locationFix the request; don't retry 401 Missing or invalid key Check JEV_API_KEY402 No balance left Add credits (Settings → Billing) 429 Rate limited Wait Retry-Afterseconds, retry503 Temporarily unavailable Retry with backoff Retry with backoff
import os, time, requests URL = "https://oramodel.com/v1/systemone" HEADERS = {"Authorization": f"Bearer {os.environ['JEV_API_KEY']}"} def decide(payload, attempts=4): for i in range(attempts): r = requests.post(URL, headers=HEADERS, json=payload, timeout=30) if r.status_code == 200: return r.json() if r.status_code in (429, 503) and i < attempts - 1: time.sleep(float(r.headers.get("Retry-After", 2 ** i))) continue raise RuntimeError(f"{r.status_code}: {r.json().get('detail')}")Stay under your limits
Limits are per organization (requests and input tokens per second), shared by all keys and the Playground. Every response carries
x-ratelimit-limit-requestsandx-ratelimit-limit-tokens. Put several questions in one request instead of one request per question.Log what you need
Log
model(the exact version) andusage.input_tokenswith each decision, so you can trace it and reconcile spend under Usage.
What's next
Create an account Open the Playground
Everything here also lives in the console, next to your keys and usage.