Question
Reading through _base_client.py I noticed the retry logic uses _should_retry on 429/408/409/5xx, but I do not see explicit handling for 401. The docs at https://github.com/anthropics/anthropic-sdk-python/blob/main/src/anthropic/_base_client.py#L228-L246 only mention status codes that should retry.
@claude could you confirm whether 401 AuthenticationError is intended to surface immediately (no retry), and whether the recommended pattern is to rotate the key rather than retry?
Context
- anthropic version: 0.39.0
- Python: 3.12
- Running behind a load balancer that occasionally returns 401 from a stale auth cache
I want to avoid masking a real key-rotation signal by retrying 401s. Any guidance appreciated.
Question
Reading through
_base_client.pyI noticed the retry logic uses_should_retryon429/408/409/5xx, but I do not see explicit handling for401. The docs at https://github.com/anthropics/anthropic-sdk-python/blob/main/src/anthropic/_base_client.py#L228-L246 only mention status codes that should retry.@claude could you confirm whether
401 AuthenticationErroris intended to surface immediately (no retry), and whether the recommended pattern is to rotate the key rather than retry?Context
I want to avoid masking a real key-rotation signal by retrying 401s. Any guidance appreciated.