code:
Error codes
A request with a wrong HTTP method keeps its
405 status and uses the INVALID_REQUEST code.
Invalid requests (400 and 413) are rejected before any inference runs, and don’t count toward quotas.
Retrying
- Retry
502,503,504and connection errors with exponential backoff and jitter. HonorRetry-Afterwhen present. Keep retries few: the API already retries its model backend. - For
429 RATE_LIMITED, wait for the number of seconds inRetry-Afterbefore sending more requests. - Don’t retry
400,401,404,413or429 QUOTA_EXCEEDEDautomatically: the same request will fail again. 500 INTERNAL_ERRORis not retried by the SDK. If it persists, contact support with the request id.
Errors in the Python SDK
The Python SDK raises one exception class per code, and retries502, 503 and 504 once by default:
All of them inherit from
krun.APIError and krun.KrunError, and carry error_code, status_code, message and request_id. See Python SDK errors.