New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

provider-fallback-plugin

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

provider-fallback-plugin

AI provider fallback management for Claude Code/OpenCode with automatic failover, usage analytics, and MCP integration

latest
Source
npmnpm
Version
2.5.0
Version published
Weekly downloads
4
100%
Maintainers
1
Weekly downloads
 
Created
Source

Provider Fallback Plugin

npm version License: MIT Node.js

AI provider fallback management for OpenCode/Claude Code with automatic failover, usage analytics, and MCP integration.

Features

  • 116 Models across 14 families (Claude, GPT, Gemini, Antigravity, GLM, Llama, etc.)
  • 25 Providers with multi-auth support (subscription, OAuth, API key)
  • Automatic Fallback when rate limits or quota exceeded
  • Usage Analytics with provider comparison and cost tracking
  • MCP Server for external integrations
  • Per-Project Settings via .opencode/provider-fallback.local.md

Installation

npm install -g provider-fallback-plugin

Then add to your OpenCode config (~/.config/opencode/opencode.json):

{
  "plugin": [
    "provider-fallback-plugin"
  ]
}

Manual Installation

git clone https://github.com/AttendantLion8/provider-fallback-plugin.git ~/plugins/provider-fallback-plugin
cd ~/plugins/provider-fallback-plugin
node scripts/install.js

Commands

CommandDescription
/provider-statusShow current provider status and usage
/provider-switch [provider]Switch to a different provider
/provider-auth [provider]Configure authentication
/provider-models [family]List available models
/provider-priority [providers...]Set provider priority order
/provider-limits [provider]Configure usage limits
/provider-analytics [period]Show usage analytics

Provider Families

FamilyProvidersAuth Types
Anthropicanthropic-subscription, anthropic-oauth, anthropic-apiAll 3
OpenAIopenai-subscription, openai-oauth, openai-apiAll 3
Googlegoogle-subscription, google-oauth, google-apiAll 3
OpenCodeopencode-antigravity-authToken
AWSbedrockIAM
AzureazureAPI Key
GitHubgithub-copilotOAuth
Vertexvertex, vertex-googleService Account
OpenRouteropenrouterAPI Key
TogethertogetherAPI Key
GroqgroqAPI Key
xAIxai-subscription, xai-apiBoth
Mistralmistral-apiAPI Key
DeepSeekdeepseek-apiAPI Key
Coherecohere-apiAPI Key
ZAIzai-coding-planToken
AntigravityantigravityToken

Model Families

FamilyModelsContextCapabilities
Claude21128K-200KText, Vision, Code
GPT398K-1MText, Vision, Code, Audio
Gemini2632K-2MText, Vision, Code, Audio
Antigravity10128K-200KText, Code, Thinking
GLM7128K-1MText, Code
Llama3128KText, Code
Mistral332K-128KText, Code
Grok3128K-1MText, Vision
DeepSeek2128KText, Code
Cohere1128KText, RAG
Qwen1128KText, Code

Usage Analytics

# View analytics dashboard
node scripts/show-analytics.js

# View with options
node scripts/show-analytics.js 7d --costs --compare

# Reset analytics
node scripts/reset-analytics.js --force

MCP Server

# Start MCP server
node mcp/server.js

# Or with custom port
MCP_PORT=3848 node mcp/server.js

Available Tools:

  • provider.list / provider.active / provider.switch
  • model.list / model.info
  • analytics.summary / analytics.providers / analytics.costs
  • auth.status / auth.check

Per-Project Configuration

Create .opencode/provider-fallback.local.md:

---
default_model: claude-sonnet-4-20250514
auto_switch: true
priority_override:
  - opencode-antigravity-auth
  - anthropic-subscription
  - openai-subscription
daily_limit: 1000
monthly_limit: 25000
---

Environment Variables

# Anthropic
ANTHROPIC_SUBSCRIPTION_KEY=...
ANTHROPIC_OAUTH_TOKEN=...
ANTHROPIC_API_KEY=...

# OpenAI
OPENAI_SUBSCRIPTION_KEY=...
OPENAI_OAUTH_TOKEN=...
OPENAI_API_KEY=...

# Google
GOOGLE_AI_SUBSCRIPTION=...
GOOGLE_OAUTH_TOKEN=...
GOOGLE_API_KEY=...

# OpenCode Antigravity
OPENCODE_ANTIGRAVITY_TOKEN=...
ANTIGRAVITY_AUTH_TOKEN=...
OC_ANTIGRAVITY_KEY=...

# AWS/Azure
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
AZURE_OPENAI_API_KEY=...

# Others
OPENROUTER_API_KEY=...
TOGETHER_API_KEY=...
GROQ_API_KEY=...
XAI_API_KEY=...
MISTRAL_API_KEY=...
DEEPSEEK_API_KEY=...
COHERE_API_KEY=...

File Structure

provider-fallback-plugin/
├── .opencode-plugin/
│   └── plugin.json           # Plugin manifest
├── agents/
│   └── provider-advisor.md   # Provider recommendation agent
├── commands/                 # 7 slash commands
├── hooks/
│   ├── hooks.json           # SessionStart + Notification hooks
│   └── scripts/             # Hook handler scripts
├── lib/
│   ├── analytics.js         # Usage tracking
│   ├── auth.js              # Authentication
│   ├── index.js             # Main export
│   ├── models.js            # 116 models
│   └── providers.js         # 25 providers
├── mcp/
│   ├── README.md            # MCP documentation
│   └── server.js            # MCP server
├── scripts/
│   ├── install.js           # Installation script
│   ├── show-analytics.js    # Analytics viewer
│   ├── reset-analytics.js   # Reset analytics
│   └── uninstall.js         # Uninstallation
├── skills/
│   └── provider-management/ # Skill documentation
├── templates/
│   └── provider-fallback.local.md
├── tests/
│   └── test.js              # Validation tests
├── package.json
└── README.md

Testing

node tests/test.js

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT © 2025 AttendantLion8

Keywords

claude-code

FAQs

Package last updated on 01 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts