Understand error codes

Diagnose 400, 401, 402, 403, 404, 429 and 5xx.

https://api.hanrouter.ai/v1Manage API keys

Requests and permissions

400: check required fields, model parameters and input format. 401: verify complete key, Bearer header, status and expiry. 402: check balance and quota. 403: check model permissions, group and key restrictions.

404: check route, HTTP method and model ID. OpenAI Base URL includes /v1; Claude Code does not. Never duplicate /v1. Query GET /v1/models for key access.

Rate limits and upstream failures

429: reduce concurrency, honor Retry-After when present and use exponential backoff with jitter. For 5xx, keep request ID, time, model and redacted error. Check whether paid image/video tasks were created before retrying.