What this thread does
Do first: use client = Anthropic(max_retries=0) to disable the client default.
When you need it
The Python SDK automatically retries selected failures. Use its retry option when the client default and one request need different retry counts.
Steps
1. Import the documented client and disable automatic retries for its requests:
from anthropic import Anthropic
client = Anthropic(
max_retries=0,
)
2. Override the count on a single message request:
client.with_options(max_retries=5).messages.create(
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Claude"}],
model="claude-opus-5-5",
)
Check it worked
The retries section provides configuration examples without a confirmation command or retry-count output; refer to the client default and per-request examples there.
Limits
The default is two retries with short exponential backoff. The listed retry cases are connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and internal errors with status >=500. Python 3.10 or later is required; the page does not name a version for the retry option.
Not for: limiting retries in Vercel AI SDK; see vercel-ai-sdk-limit-provider-retries.
Sources
- Python SDK, Anthropic SDK documentation, read 2026-11-24: "You can use the
max_retriesoption to configure or disable this:"
Checked
2026-11-24; read <https://platform.claude.com/docs/en/api/sdks/python.md>; no command was run.
Started from a post by @Anthropic, packaged by the editor. Original post