claude-provider
officialCLI tool and Claude Code plugin to switch between API providers (Anthropic, Kimi, Qwen, DeepSeek, MiniMax, Z.ai)
Claude Provider
Plugin & CLI tool to switch between LLM providers in Claude Code
A powerful tool that enables you to manage and switch between multiple LLM API providers for Claude Code. Available as both a Claude Code plugin and a standalone CLI.
✨ Features
- 🔄 Instant Provider Switching — Switch between providers with a single command
- � Dual Mode — Use as a Claude Code plugin or standalone CLI tool
- 📦 Pre-configured Presets — Ready-to-use configurations for popular providers
- 🎛️ Custom Configurations — Create profiles with custom base URLs and models
- 📸 Profile Snapshots — Save your current settings as reusable profiles
- 🔐 Secure — API keys are masked in output; file permissions are restricted
🚀 Installation
Prerequisites
- Claude Code installed
- Node.js v18 or higher
Install via npm (Recommended)
npm install -g claude-provider
This installs both the Claude Code plugin and the CLI tool.
🔌 Plugin Usage
Use the provider commands directly within Claude Code via slash commands.
Setup Plugin
Via Marketplace:
# Add the marketplace
/plugin marketplace add iqbal-rashed/claude-provider-plugin
# Install the plugin
/plugin install provider@claude-provider-plugin
Plugin Commands
Switch Provider
/provider:switch <profile_name>
Switch to a different provider profile instantly.
List Profiles
/provider:list
View all available profiles and see which one is currently active.
Add Provider
/provider:add <name>
Create a new profile from a preset or custom configuration. You’ll be prompted for:
- Preset — Choose from available presets or
custom - API Key — Your provider’s API key
- Model (optional) — Override the default model
Snapshot Settings
/provider:snapshot <name>
Save your current ~/.claude/settings.json as a named profile for later use.
Delete Profile
/provider:delete <profile_name>
Remove a profile you no longer need.
📖 CLI Usage
After installation, you can use claude-provider or the shorthand cpr from your terminal.
Interactive Mode
claude-provider
# or
cpr
Launches an interactive menu to:
- View and switch between providers
- Add new providers (from presets or custom)
- Manage existing providers (edit/delete)
Quick Switch
claude-provider <provider_name>
# or
cpr kimi
Switch directly to a provider by name.
List Providers
claude-provider --list
# or
cpr -l
Display all installed providers with the active one highlighted.
Keychain Credential Swap (macOS, opt-in)
When multiple profiles target the same Anthropic account (e.g. a Pro plan and a Team plan on one login), settings.json alone isn’t enough to switch — Claude Code authenticates via an OAuth blob in the macOS keychain. The credential subcommand snapshots that blob per profile so switch can restore the correct one.
# Snapshot the current keychain credential for the active profile
cpr credential save anthropic
# Restore a previously saved credential to the keychain
cpr credential restore anthropic
# List saved credentials
cpr credential list
# Auto-restore on switch (opt-in via env var)
CPR_SWAP_CREDENTIALS=1 cpr switch anthropic-team
macOS only. Without CPR_SWAP_CREDENTIALS the switch command never touches the keychain, so existing users are unaffected.
🎯 Supported Providers
| Provider | Preset Key | Default Model |
|---|---|---|
| Anthropic | anthropic | claude-sonnet-4.5 |
| Z.ai (GLM) | zai | glm-4.7 |
| MiniMax | minimax | minimax-m2.1 |
| Kimi (Moonshot) | kimi | kimi-k2.5 |
| Qwen (DashScope) | qwen | qwen-max-latest |
| DeepSeek | deepseek | deepseek-chat |
| Custom | custom | User defined |
💡 Tip: When using a preset, you can optionally specify a custom model to override the default.
🔧 How It Works
- Profiles are stored as
~/.claude/settings.<name>.json - Switching copies the target profile to
~/.claude/settings.json - Plugins preserved — Your enabled plugins are maintained when switching providers
- MCP Protocol ensures safe, structured file system interactions (plugin mode)
🐛 Troubleshooting
| Issue | Solution |
|---|---|
| Command not found | Run npm install -g claude-provider or check your PATH |
| Plugin not found | Ensure you used the absolute path to the plugin directory |
| Command not recognized | Restart Claude Code after installing the plugin |