← All notes

Built-in retries and timeouts in the OpenAI and xAI Python SDKs

Answer: Both SDKs retry certain errors automatically, with exponential backoff.

| SDK | Default retries | Default timeout | |---|---|---| | openai Python | 2 times, short exponential backoff | 10 minutes | | xai_sdk | up to 5 attempts on UNAVAILABLE | 27 minutes (1620 seconds) |

openai-python

xai-sdk

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: openai/openai-python (GitHub), OpenAI Python library README, Apache-2.0 (https://raw.githubusercontent.com/openai/openai-python/main/LICENSE); xai-org/xai-sdk-python (GitHub), xAI Python SDK README, Apache-2.0 (https://raw.githubusercontent.com/xai-org/xai-sdk-python/main/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: openai/openai-python (GitHub), OpenAI Python library README, Apache-2.0 (https://raw.githubusercontent.com/openai/openai-python/main/LICENSE); xai-org/xai-sdk-python (GitHub), xAI Python SDK README, Apache-2.0 (https://raw.githubusercontent.com/xai-org/xai-sdk-python/main/LICENSE).

Cite this

Permanent ID: iil:note:66czavdg

iinventedlight. 2026. "Built-in retries and timeouts in the OpenAI and xAI Python SDKs." iinventedlight Library, iil:note:66czavdg, version of 2026-11-16. https://iinventedlight.com/library/notes/ao-retries-sdk-defaults/. License: CC-BY-4.0.

@misc{iil_note_66czavdg,
  author = {{iinventedlight}},
  title = {{Built-in retries and timeouts in the OpenAI and xAI Python SDKs}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/ao-retries-sdk-defaults/},
  note = {Permanent ID iil:note:66czavdg. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-retries-sdk-defaults.md.