Let Agents WorkSETUP

Free guide

Claude Code Fallbacks & Memory Setup

Stop losing hours to rate limits and context wipes.

What You Need


Step-by-Step Guide

Step 1: Install your local router

Open your terminal and install LiteLLM to handle your multi-model routing locally.

pip install litellm[proxy]

Step 2: Create your fallback configuration

Create a file named config.yaml in your project folder. Paste this exact structure to route overflow requests from Claude 3.5 Sonnet to a backup model when rate limits hit:

model_list:
  - model_name: claude-3-5-sonnet
    litellm_params:
      model: anthropic/claude-3-5-sonnet-20241022
      api_key: os.environ/ANTHROPIC_API_KEY
      fallbacks: [{"model": "openai/gpt-4o"}]

Step 3: Set your environment variables

In your terminal, securely load your API keys so the router can access them:

export ANTHROPIC_API_KEY="your-anthropic-key-here"
export OPENAI_API_KEY="your-backup-key-here"

Step 4: Start the local proxy

Run the router locally on port 4000:

litellm --config config.yaml --port 4000

Step 5: Add persistent memory

To keep your project context across restarts, create a .claudememory folder in your root directory. Claude Code reads files in this directory automatically on startup, so your project rules and state persist even if the session crashes.


Common Mistakes & Fixes


Follow @letagentswork for more practical agent setups that save you time.

Best AI agents this week, every Friday

One short email: the agents and workflows we built, with the free guides. No spam.

Building agents too? Ask questions and get new builds first in Agent Lab on Telegram (free).

Made by Let Agents Work — follow @letagentswork
From the reel: Stop Claude Code Rate Limits With Multi-Model Fallbacks