model-failover
Original:🇺🇸 English
Translated
1 scriptsChecked / no sensitive code detected
Automatic LLM provider failover with fallback chains, inspired by OpenClaw/ZeroClaw model configuration.
2installs
Added on
NPX Install
npx skill4agent add winsorllc/upgraded-carnival model-failoverTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Model Failover Skill
Automatically switch between LLM providers when one fails. Supports configurable fallback chains, rate limiting, and health monitoring. Inspired by OpenClaw's model failover system.
Setup
Configure your provider chain in environment variables:
bash
# Comma-separated list of providers (in fallback order)
export LLM_PROVIDER_CHAIN="anthropic:claude-3-5-sonnet-20241022,openai:gpt-4o-mini,google:gemini-1.5-flash"
# API keys for each provider
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENAI_API_KEY="sk-..."
export GOOGLE_API_KEY="..."Usage
Chat with automatic failover
bash
{baseDir}/model-failover.js chat "Your message here"Add a new provider to the chain
bash
{baseDir}/model-failover.js add-provider anthropic claude-3-5-sonnet-20241022Remove a provider from the chain
bash
{baseDir}/model-failover.js remove-provider openaiList providers in chain
bash
{baseDir}/model-failover.js listCheck provider health
bash
{baseDir}/model-failover.js healthReset failure counts
bash
{baseDir}/model-failover.js resetConfiguration
| Environment Variable | Description | Default |
|---|---|---|
| Comma-separated | |
| Anthropic API key | - |
| OpenAI API key | - |
| Google API key | - |
| Custom provider API key | - |
| Max retries per provider | 2 |
| Delay between retries | 1000 |
Provider Format
provider:modelSupported providers:
- - Anthropic Claude models
anthropic - - OpenAI GPT models
openai - - Google Gemini models
google - - Custom OpenAI-compatible endpoint (set
custom)OPENAI_BASE_URL
How It Works
- Try the first provider in the chain
- If it fails (rate limit, error, timeout), wait and retry
- If retries exhausted, move to next provider
- Continue until success or all providers exhausted
- Track failures per provider for health monitoring