Reliability
Concrete targets, retry semantics, and what happens to your request when the upstream hiccups.
Targets we measure against
| Surface | Target | 30-day actual |
|---|---|---|
| API gateway availability | 99.9% | See the dashboard |
| /v1/messages p50 latency (first byte, streaming) | < 300 ms | See the dashboard |
| Top-up credit to key | As soon as the payment is confirmed | Processed immediately after validation |
Retry semantics
The gateway is idempotent-safe on retries for 5xx. What this means operationally:
- 2xx — the upstream processed the request. Tokens are billed. Don’t retry.
- 4xx — your request is malformed or the key is in trouble (401 invalid or expired key, 402 insufficient balance, 400 schema, 429 rate limit). Fix the request or the key; don’t retry blindly.
- 5xx — upstream or edge failed before the upstream billed us. You can retry with backoff; no double-billing risk.
Recommended backoff
# Minimal exponential backoff with jitter — 3 attempts, max ~5s total.
import random, time
delays = [0.5, 1.0, 2.0]
for d in delays:
try:
return call()
except RateLimitError:
time.sleep(d + random.uniform(0, 0.25))
except APIStatusError as e:
if 500 <= e.status_code < 600:
time.sleep(d + random.uniform(0, 0.25))
else:
raiseStreaming reliability
Use stream: true for any call where the generation might exceed 60 seconds (long context, big max_tokens, agent loops). Header timers in most HTTP libraries fire at 60–120s — streaming sidesteps that because the first message_start event arrives in ~100ms. Our gateway relays each chunk as soon as the upstream emits it, with no buffering.
What a 503 means
503 “no available accounts” signals a real, temporary saturation of upstream capacity. Handle it with exponential backoff (500 ms / 1 s / 2 s), 3 attempts at most. A 503 that lasts more than a minute is an upstream incident, not a problem with your request. Note: on the Anthropic-native surface, an unknown model id does not return a 503 — the gateway immediately returns 400 invalid_request_error, with the list of supported ids. The official list is on Models.