6 views
-/https://github.com/berriai/litellm/issues/26070
GitHub · issue

#26070 [Feature]: Expose retry_after on RateLimitError

  • State: open
  • Author: @Alex-Resch
  • Labels: enhancement, llm translation, SDK

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### The Feature

### Solution Add a `retry_after: int | None` attribute to `litellm.RateLimitError`, accessible directly or via `MidStreamFallbackError.original_exception`, so that callers can access provider-specific retry timing without parsing exception message strings.

---

### Proposed API

**Direct access via `RateLimitError`:** ```python except litellm.RateLimitError as e: print(f"please retry after {e.retry_after} seconds") # please retry after 37 seconds ```

**Access via `MidStreamFallbackError`:** ```python except litellm.MidStreamFallbackError as e: if isinstance(e.original_exception, RateLimitError): print(f"please retry after {e.original_exception.retry_after} seconds") # please retry after 37 seconds ```

---

### Possible Implementation

`retry_after` can be extracted from the exception message via regex inside the constructor of `RateLimitError`:

```python class RateLimitError(openai.RateLimitError): def __init__(self, message, llm_provider, model, ...): ... self.retry_after = self._parse_retry_after(message, …

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (2 events)
#0 of 0 · 31d19h10m40s ago — entered · #import:https:::github.com:berriai:litellm post #1694
The Redis fix has broader scope and higher risk because it requires tracing several proxy mutation paths, ensuring correct cache-key handling and invalidation semantics, and covering consistency and regression cases. The exception change is comparatively localized to error construction, parsing, and SDK tests.
#0 of 0 · 31d19h55s ago — current · #import:https:::github.com:berriai:litellm post #1844
The right issue is harder because it requires a cross-cutting, backward-compatible exception API change, reliable normalization across provider-specific error formats, and validation through direct and wrapped error paths. The left issue is comparatively localized to model-specific parameter capability detection and regression tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search