Diagnose & Fix 10 Common HTTP 4xx/5xx API Errors
Exact root causes, JSON error payloads, and production retry/failover code so your API Store Hub integration stays resilient 24/7.
Need resilient routing with automatic multi-upstream failover and full request telemetry on API Store Hub?
API Error Troubleshooting Hub
| HTTP Status | Error type | API Error Codes | Retry policy |
|---|---|---|---|
429 | rate_limit_exceeded | HTTP 429 Rate Limit Exceeded — RPM/TPM Throttling Fix | Triggered when requests-per-minute or tokens-per-minute exceed key or upstream thresholds. Recover cleanly with jittered exponential backoff and worker queuing. |
529 | overloaded_error | HTTP 529 Anthropic Overloaded — Claude Capacity Recovery | Anthropic-specific status on /v1/messages indicating momentary Claude capacity saturation. Safe to retry with jitter or route to a fallback lane. |
403 | unsupported_country_region_territory | HTTP 403 Region / Country Not Supported — Geo-Block Fix | Direct vendor endpoints return 403 for unsupported server IPs or regions. Routing through https://apistorehub.com/v1 resolves geo-blocks cleanly without fragile VPNs. |
402 | insufficient_quota | HTTP 402 Insufficient Balance / Quota — Wallet & Cap Fix | Returned when wallet balance cannot cover the request pre-hold or a per-key spend limit is reached. Alert billing ops instead of looping retries. |
400 | context_length_exceeded | HTTP 400 Context Length Exceeded — Prompt Window Overflow Fix | Total tokens across system prompt, message history, tool definitions, and max_tokens exceeded the model window. Apply sliding-window trimming or switch to a long-context model. |
401 | invalid_api_key | HTTP 401 Invalid API Key — Authentication Header Fix | The Gateway rejects the request due to a revoked API key, extra spaces, wrong sk-ash- prefix, or sending the wrong header format between OpenAI and Anthropic. |
504 | gateway_timeout | HTTP 504 Gateway Stream Timeout — Streaming & Timeout Fix | Common when disabling streaming (stream: false) on long reasoning or generation tasks, causing proxies or clients to time out before the full payload finishes. |
422 | invalid_tool_schema | HTTP 422 Tool Use / JSON Schema Invalid — Schema Validation Fix | Raised when tools or response_format json_schema uses unsupported keywords, omits additionalProperties: false, or has invalid tool names. |
413 | payload_too_large | HTTP 413 Payload Too Large — Image & Media Size Fix | Triggered when embedding huge uncompressed images or PDFs as inline base64 inside JSON. Resize/compress assets or pass HTTPS URLs instead. |
502 | bad_gateway | HTTP 502 Bad Gateway — Upstream Outage & Failover Guide | Occurs when an origin AI vendor drops a connection or experiences a transient outage. API Store Hub automatically fails over lanes, and clients should pair a cross-family fallback model. |
Frequently asked questions
- Am I billed on API Store Hub when an HTTP 4xx/5xx (HTTP Error) error occurs?
- No. Atomic pre-hold settlement on API Store Hub automatically releases any reserved amount for failed requests that return no valid completion.
- How do I tell whether the error originated from my client or upstream?
- 4xx codes (except 429) usually point to auth headers, wallet quota, or request payload formatting; 429/502/504/529 indicate load or transient upstream conditions visible on /status.
- Can I fall back to another model without changing SDKs?
- Yes. Pass the fallback model ID (e.g. across Claude, GPT, DeepSeek, or Gemini) inside your retry catch block using your existing sk-ash- API key.