BerriAI/litellm · error · RateLimitError

BedrockException: Rate Limit Error - {error_str}

Error message

BedrockException: Rate Limit Error - {error_str}

What it means

Bedrock-specific: RateLimitError raised when the AWS error text contains 'throttlingException' or 'ThrottlingException'. AWS is throttling the request because you exceeded your account's limits for the model — on-demand TPM/RPM quotas or provisioned throughput capacity.

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 6c2dcb801b)

Solutions

  1. Retry with exponential backoff and jitter — ThrottlingException is standard retryable (num_retries + retry_after).
  2. Throttle clients: litellm.Router with rpm/tpm settings per bedrock deployment; honor model-level quotas.
  3. Request a quota increase (Service Quotas console) or buy provisioned throughput for steady load.
  4. Cache identical responses to reduce call volume.

Example fix

# before
for m in batch:
    out.append(litellm.completion(model="bedrock/anthropic.claude-3-5-sonnet-20240620-v1:0", messages=[m]))

# after
from litellm import Router
router = Router(
    model_list=[{"model_name": "b", "litellm_params": {"model": "bedrock/anthropic.claude-3-5-sonnet-20240620-v1:0", "rpm": 50, "tpm": 50000}}],
    num_retries=5, retry_after=20,
)
for m in batch:
    out.append(router.completion(model="b", messages=[m]))
Defensive patterns

Strategy: retry

Type guard

import litellm

def is_bedrock_throttle(e: BaseException) -> bool:
    return isinstance(e, litellm.RateLimitError) and getattr(e, "llm_provider", "") == "bedrock"

Try / catch

try:
    resp = litellm.completion(model="bedrock/...", messages=msgs, num_retries=5, retry_after=20)
except litellm.RateLimitError:
    router.completion(model="bedrock-fallback", messages=msgs)

Prevention

When it happens

Trigger: Bursts or sustained load beyond the model's on-demand quota (per-model TPM/RPM), too many concurrent streams, or provisioned-throughput endpoints saturated. Bedrock returns ThrottlingException with HTTP 400, so generic status mapping would miss it — hence this keyword rule.

Common situations: Batch/eval jobs fanning out across many workers, agent loops with tight iteration, default low quotas for newly enabled models, or multiple teams sharing one AWS account's quota.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/d9bb083a662d9691. Report an issue: GitHub.