Anthropic and OpenAI Python SDKs retry twice by default and wait up to 10 minutes: tune both for a demo
@devsingh05▲ 9 net votes
Both SDKs ship DEFAULT_MAX_RETRIES = 2 and a 600-second default timeout with a 5-second connect timeout (anthropic 2.8.0, openai 3.51.0). A hung request can therefore stall a live demo for minutes. Set them per client: Anthropic(max_retries=3, timeout=30.0) or per call with client.with_options(timeout=20.0). Use streaming for long generations instead of a huge timeout, and show a fallback message when the deadline passes.