BerriAI/litellm · error · RateLimitError
BedrockException: Rate Limit Error
Error message
BedrockException: Rate Limit Error - {error_str} What it means
LiteLLM throws RateLimitError when Bedrock returns throttlingException (either capitalization matched at litellm/litellm_core_utils/exception_mapping_utils.py:876): account-level requests/tokens-per-minute quotas for the model, or OnDemand capacity limits, were exceeded. It is the one Bedrock client error that is expected and retriable - backoff and quota management are the intended responses.
Solutions
- Enable managed retries with backoff: litellm.completion(..., num_retries=3) (proxy: litellm_settings num_retries plus cooldown_time)
- Reduce concurrency or spread load across model ids / inference profiles, each with its own quota
- Request a TPM/RPM quota increase in AWS Service Quotas for the model
- Configure litellm.Router with fallback deployments so throttled calls overflow to another model/provider
Example fix
# before resp = litellm.completion(model="bedrock/anthropic.claude-3-sonnet-...", messages=msgs) # throttlingException # after resp = litellm.completion(model="bedrock/anthropic.claude-3-sonnet-...", messages=msgs, num_retries=4)
Defensive patterns
Strategy: retry
Type guard
import litellm
def is_rate_limit(e: BaseException) -> bool:
return isinstance(e, litellm.RateLimitError) Try / catch
import random, time
import litellm
for attempt in range(5):
try:
return litellm.completion(model='bedrock/...', messages=msgs)
except litellm.RateLimitError:
time.sleep((2 ** attempt) + random.random())
# or simply: litellm.completion(..., num_retries=4) — litellm backs off automatically Prevention
- Set num_retries and Router cooldown_time on proxy deployments
- Size client concurrency to the model's documented TPM/RPM quota
- Request quota increases before launch, not after throttling starts
- Spread load across model ids / inference profiles with separate quotas
When it happens
Trigger: Bursty or sustained litellm.completion(model='bedrock/...') traffic exceeding the model's TPM/RPM quota; high-concurrency proxy load funneled to a single model id; parallel test suites hammering one endpoint.
Common situations: Load tests against a single model; production traffic spikes; low default quotas on newly enabled models; naive retry loops without jitter that amplify throttling.
Related errors
- AgentCore: Failed to read/parse JSON response body
- Amazon Nova Canvas INPAINTING requires either maskPrompt or…
- Amazon Nova Canvas requires a text prompt. Pass a non-empty…
- Batch record for /v1/completions is missing required…
- Batch record for /v1/responses is missing required `input`…
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/d9bb083a662d9691.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:876
elif (
"Unable to locate credentials" in error_str
or "The security token included in the request is invalid" in error_str
):
raise AuthenticationError(
message=f"BedrockException Invalid Authentication - {error_str}",
model=model,
llm_provider="bedrock",
response=getattr(original_exception, "response", None),
)
elif "AccessDeniedException" in error_str:
raise PermissionDeniedError(
message=f"BedrockException PermissionDeniedError - {error_str}",
model=model,
llm_provider="bedrock",
response=getattr(original_exception, "response", None),
)
elif "throttlingException" in error_str or "ThrottlingException" in error_str:
raise RateLimitError(
message=f"BedrockException: Rate Limit Error - {error_str}",
model=model,
llm_provider="bedrock",
response=getattr(original_exception, "response", None),
)
elif "Connect timeout on endpoint URL" in error_str or "timed out" in error_str:
raise Timeout(
message=f"BedrockException: Timeout Error - {error_str}",
model=model,
llm_provider="bedrock",
)
elif "Could not process image" in error_str:
raise litellm.InternalServerError(
message=f"BedrockException - {error_str}",
model=model,
llm_provider="bedrock",
)
elif hasattr(original_exception, "status_code"):View on GitHub (pinned to 77b7c6c40c)