Skip to main content

LLM Provider Resilience Best Practices

This guide provides production-ready strategies for managing rate limits, concurrency, and resilience across multiple LLM providers. These patterns ensure optimal throughput while preventing rate limit errors and cascading failures.

Overview

When integrating with LLM APIs, you must balance three competing concerns:
  1. Latency - Minimize response time for individual requests
  2. Throughput - Maximize total requests per unit time
  3. Reliability - Prevent rate limit errors and service degradation
This guide covers the mathematical foundations, provider-specific configurations, and implementation patterns to achieve this balance.

Provider Rate Limits Reference

Anthropic Claude (Direct API)

Anthropic uses a tiered system based on usage history. Rate limits are measured in:
  • RPM (Requests Per Minute)
  • ITPM (Input Tokens Per Minute)
  • OTPM (Output Tokens Per Minute)
Anthropic uses the token bucket algorithm for rate limiting. Capacity continuously replenishes up to your maximum limit, rather than resetting at fixed intervals.
Token Limits (Build Tier):
  • Claude 3.5 Sonnet: 40,000 TPM
  • Claude 3 Opus: 20,000 TPM
  • Claude 3 Haiku: 50,000 TPM
For Scale Tier or higher limits, contact Anthropic sales.

OpenAI (Direct API)

OpenAI organizes customers into usage tiers that unlock automatically based on spend:
As of September 2025, OpenAI increased GPT-5 Tier 1 limits to 500,000 TPM and 1,000 RPM.
Shared Limits: Some model families share rate limits. Check your organization’s limits page in the OpenAI Dashboard.

Google Vertex AI (Gemini)

Gemini models on Vertex AI use Dynamic Shared Quota (DSQ) - no hard per-user limits. Quotas are shared across the platform based on capacity.
With DSQ, focus on monitoring actual throughput rather than pre-defined limits. Use adaptive concurrency (see below) to maximize utilization.

Google Vertex AI (Anthropic Claude via MaaS)

Anthropic Claude models accessed through Vertex AI have different limits than the direct API:
Claude models are only available in the us-east5 region on Vertex AI. Ensure your application accounts for this geographic constraint.

Azure OpenAI Service

Azure quotas are per-region, per-subscription. The TPM/RPM conversion is:
Azure allows creating deployments across multiple regions. Your effective limit is quota × number_of_regions.

AWS Bedrock (Anthropic Claude)

AWS Bedrock quotas are region-specific and vary by account age:
New AWS accounts created since 2024 receive significantly lower default quotas. Use established accounts or request quota increases.
Multi-Region Strategy:

Concurrency Sizing with Little’s Law

Little’s Law provides the mathematical foundation for sizing concurrent request pools:

Little's Law

Where:
  • Concurrency = Number of parallel requests in flight
  • Throughput = Requests per second (RPM ÷ 60)
  • Average Latency = Mean response time in seconds

Practical Application

Example: Claude Sonnet 4.5 on Vertex AI Given:
  • RPM limit: 3,000
  • Average latency: 1.2 seconds
Calculate:
Recommended: Apply 60% Headroom

Per-Provider Recommendations


Adaptive Concurrency with AIMD

The AIMD (Additive Increase, Multiplicative Decrease) algorithm, inspired by TCP congestion control, automatically tunes concurrency limits based on observed error rates.

How AIMD Works

Parameters:
  • min_limit: Floor value (e.g., 2)
  • max_limit: Ceiling value (e.g., 50)
  • initial_limit: Starting point (e.g., 10)
  • success_streak_threshold: Successes before increase (e.g., 10)
  • decrease_factor: Multiplicative factor on error (e.g., 0.75)
Benefits:
  • Self-healing: Automatically recovers from rate limit errors
  • Adaptive: Finds optimal concurrency for current conditions
  • Conservative: Fast decrease, slow recovery prevents oscillation

Implementation


Token Bucket Rate Limiting

The token bucket algorithm provides pre-emptive rate limiting with burst capacity, preventing rate limit errors before they occur.

How Token Bucket Works

1

Bucket Capacity

Bucket holds tokens up to a maximum (burst) capacity
2

Token Consumption

Each request consumes one token from the bucket
3

Refill Rate

Tokens are added at a constant rate (RPM ÷ 60)
4

Request Gating

Requests wait if bucket is empty (no 429 errors)

Implementation

Per-Provider Defaults


Fallback Strategies

When the primary model fails (rate limit, timeout, circuit open), fallbacks maintain service availability.

Fallback Chain Pattern

Best Practices

Protect Fallbacks

Each fallback model should have its own circuit breaker to prevent cascade failures

Exponential Backoff

Wait 1s, 2s, 4s between fallback attempts to let rate limits recover

Cross-Provider

Include models from different providers in fallback chain

Graceful Degradation

Fallbacks may have different capabilities - handle appropriately

Retry with Backoff Strategies

Standard vs Overload-Aware Retry

Retry-After Header

When receiving a 429 response, use the Retry-After header:

Error Classification


Quota Management by Provider

This section provides detailed step-by-step instructions for requesting and managing quota increases for each LLM provider.

Google Cloud Platform (Vertex AI)

GCP Vertex AI quotas control access to Gemini models and Anthropic Claude models (via Model as a Service).

AWS Bedrock

AWS Bedrock quotas are managed through Service Quotas and vary by region and account age.
Step-by-Step: AWS Console
  1. Navigate to Service Quotas
  2. Find the Model Quota
    • Search for the model name (e.g., “Claude 3.5 Sonnet”)
    • Look for quotas like:
      • Anthropic Claude 3.5 Sonnet Invocations per minute
      • Anthropic Claude 3.5 Sonnet Tokens per minute
  3. Request Increase
    • Click on the quota name
    • Click Request quota increase
    • Enter desired value (e.g., 500 for RPM)
    • Click Request
  4. Check Status
    • Go to Quota request history
    • Status will show: Pending → Approved/Denied
Account Age Matters: New AWS accounts (created after 2024) receive significantly lower default quotas (2-50 RPM). Consider using established accounts or requesting increases immediately.

Azure OpenAI Service

Azure OpenAI quotas are managed per-subscription, per-region, and can be allocated across deployments.
Step-by-Step: Azure Portal
  1. Access Azure OpenAI Studio
  2. View Current Quotas
    • Click Quotas in the left sidebar
    • View available TPM by model and region
  3. Adjust Deployment Quota
    • Go to Deployments
    • Select your deployment → Edit
    • Adjust Tokens per Minute Rate Limit
    • Click Save
  4. Request Additional Quota
    • If you need more than your subscription limit:
    • Go to Help + supportNew support request
    • Select: Issue type = Service and subscription limits (quotas)
    • Service = Azure OpenAI Service
    • Provide justification and desired limits
TPM to RPM Conversion: RPM = TPM ÷ 1000 × 6Example: 240,000 TPM = 1,440 RPM

Anthropic (Direct API)

Anthropic uses a tier-based system that advances automatically based on usage and spend.
Understanding Anthropic Tiers
Tiers advance automatically based on successful API usage and payment history. There’s no manual upgrade process for Free → Build → Scale.

OpenAI (Direct API)

OpenAI uses automatic tier advancement based on account spend and history.
Understanding OpenAI Tiers

Configuration Reference

Environment Variables

Provider-Specific Configuration


Monitoring and Observability

Key Metrics

Grafana Dashboard

See monitoring/grafana/dashboards/llm-resilience.json for a pre-built dashboard.

Summary

Quick Start Checklist

  1. Identify your provider tier and corresponding limits
  2. Calculate concurrency using Little’s Law with 60% headroom
  3. Configure token bucket for pre-emptive rate limiting
  4. Enable adaptive bulkhead for self-tuning concurrency
  5. Set up fallback chain with exponential backoff
  6. Monitor metrics and adjust based on observed behavior

References


Last Updated: December 2025