Skip to content

Add retry support for OpenAI-compatible LLM providers#37891

Merged
bennetbo merged 4 commits intozed-industries:mainfrom
timmclean:llm-retry
Nov 13, 2025
Merged

Add retry support for OpenAI-compatible LLM providers#37891
bennetbo merged 4 commits intozed-industries:mainfrom
timmclean:llm-retry

Conversation

@timmclean
Copy link
Contributor

Automatically retry the agent's LLM completion requests when the provider returns 429 Too Many Requests. Uses the Retry-After header to determine the retry delay if it is available.

Many providers are frequently overloaded or have low rate limits. These providers are essentially unusable without automatic retries.

Tested with Cerebras configured via openai_compatible.

Related: #31531

Release Notes:

  • Added automatic retries for OpenAI-compatible LLM providers

Automatically retry the agent's LLM completion requests when the
provider returns 429 Too Many Requests using the Retry-After header if
available.

Many providers are frequently overloaded or have low rate limits. These
providers are essentially unusable without automatic retries.

Tested with Cerebras configured via openai_compatible.
@cla-bot
Copy link

cla-bot bot commented Sep 10, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @timmclean on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@timmclean
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Sep 10, 2025
@cla-bot
Copy link

cla-bot bot commented Sep 10, 2025

The cla-bot has been summoned, and re-checked this pull request!

@SomeoneToIgnore SomeoneToIgnore added the area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features label Sep 10, 2025
@benbrandt benbrandt self-assigned this Sep 12, 2025
@bennetbo bennetbo assigned bennetbo and unassigned benbrandt Nov 3, 2025
@bennetbo
Copy link
Member

Hey @timmclean, sorry for taking such a long time to review this. I just solved the merge conflicts. Can you confirm that this is still working as expected on your end?

@timmclean
Copy link
Contributor Author

Oh great, I will test this in a bit! If I remember correctly, I didn't implement the retries for Anthropic and some other providers. Would you like me to do that? I'm happy to do it to fix #31531 but I can't promise I'll test with every provider since I don't have accounts everywhere

@bennetbo
Copy link
Member

bennetbo commented Nov 12, 2025

I'd like to get this in without making more changes first. However, I would be more than happy to review follow-up PRs that implement this for other providers.

@timmclean
Copy link
Contributor Author

Sounds good. I just tested with your rebase and things look good:

Screenshot from 2025-11-12 14-26-10

@bennetbo bennetbo enabled auto-merge (squash) November 13, 2025 14:12
@bennetbo bennetbo merged commit fb90b12 into zed-industries:main Nov 13, 2025
62 of 68 checks passed
11happy pushed a commit to 11happy/zed that referenced this pull request Dec 1, 2025
…#37891)

Automatically retry the agent's LLM completion requests when the
provider returns 429 Too Many Requests. Uses the Retry-After header to
determine the retry delay if it is available.

Many providers are frequently overloaded or have low rate limits. These
providers are essentially unusable without automatic retries.

Tested with Cerebras configured via openai_compatible.

Related: zed-industries#31531 

Release Notes:

- Added automatic retries for OpenAI-compatible LLM providers

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants