Install
openclaw skills install @eohmig/cc-switchManage API providers for Codex and compatible CLI tools with automatic mode detection, pre-switch connectivity tests, and endpoint URL updates.
openclaw skills install @eohmig/cc-switchA provider management skill that works in two modes automatically:
| Mode | When Active | Data Storage |
|---|---|---|
| cc-switch mode | cc-switch desktop app is installed (~/.cc-switch/cc-switch.db exists) | SQLite database |
| standalone mode | cc-switch is NOT installed | JSON files (~/.cc-switch-skill/) |
The skill automatically detects which mode to use - no manual configuration needed.
| Application | app_type | Hot-Switch |
|---|---|---|
| Codex | Codex | Endpoint-only |
| Codex | codex | ❌ No |
| Gemini CLI | gemini | ❌ No |
| OpenCode | opencode | ❌ No |
| OpenClaw | openclaw | ❌ No |
The skill checks for ~/.cc-switch/cc-switch.db:
~/.cc-switch-skill/)You can install/remove cc-switch anytime and the skill will automatically adapt.
~/.cc-switch/cc-switch.db~/.cc-switch-skill/config.json — Active providers per app~/.cc-switch-skill/providers.json — All configured providers~/.Codex/skills/cc-switch/presets.json — Built-in presets~/.Codex/skills/cc-switch/scripts/add_provider.sh \
--name "MiniMax" \
--app Codex \
--key "sk-xxxx" \
--url "https://api.minimax.com/v1" \
--sonnet "Codex-3-5-sonnet-20241022"
~/.Codex/skills/cc-switch/scripts/list_providers.sh
~/.Codex/skills/cc-switch/scripts/list_providers.sh --app Codex
Output shows the current mode:
======================================
Providers List
======================================
Mode: [cc-switch mode]
### Codex
ID | Name | Status
--------------------------------------+------------------------------+--------
a1b2c3d4-e5f6-7890-abcd-ef1234567890 | Anthropic Official | 🟢 [Active]
~/.Codex/skills/cc-switch/scripts/switch_provider.sh \
--app Codex \
--name "MiniMax"
Important: Switching runs a connectivity test first:
To skip the connectivity check (advanced use):
~/.Codex/skills/cc-switch/scripts/switch_provider.sh \
--app Codex \
--name "MiniMax" \
--skip-test
~/.Codex/skills/cc-switch/scripts/delete_provider.sh --id provider-uuid
Cannot delete currently active provider - must switch first.
~/.Codex/skills/cc-switch/scripts/test_connectivity.sh --app Codex --name "MiniMax"
Built-in provider presets in presets.json work in standalone mode:
| Name | App | Description |
|---|---|---|
| Anthropic Official | Codex, gemini | Official Anthropic API |
| MiniMax Official | Codex | Official MiniMax API |
| Zhipu AI Official | Codex | Official Zhipu AI endpoint |
| DeepSeek Official | Codex | Official DeepSeek API |
Presets are used as templates - you provide your own API key when adding.
Only Codex supports hot-switching — changes take effect immediately without restarting the terminal.
For all other apps, you must restart the terminal or CLI tool after switching providers.
add_provider.sh with your credentialstest_connectivity.sh to verifyswitch_provider.sh (auto-tests first)list_providers.sh to see all optionsUser: I want to switch to MiniMax
Codex: Running switch_provider.sh --app Codex --name MiniMax
[Connectivity test runs...]
✅ Connectivity test passed
Switching Codex to MiniMax...
✅ Successfully switched Codex provider to: MiniMax
ℹ️ Codex supports hot-switching - changes take effect immediately!
User: Test the connection
Codex: test_connectivity.sh --app Codex --name MiniMax
[Shows detailed test results]
User: Switch to TestProvider
Codex: Running switch_provider.sh...
======================================
Connectivity Test FAILED
======================================
Error Details:
HTTP Status: 401
API Endpoint: https://api.test.com/v1
Model: test-model
Response:
{"error": {"type": "authentication_error", "message": "Invalid API key"}}
======================================
⚠️ The connectivity test failed.
Possible causes:
- Invalid API key
- Incorrect base URL
- Model name mismatch
- Network connectivity issues
Do you want to switch to this provider anyway? (yes/no)
The skill manages provider configurations but updates to CLI tool settings vary:
switch_provider.sh treats Codex specially:
base_url~/.Codex/settings.json and updates .env.ANTHROPIC_BASE_URLsettings.jsonResulting shape:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.minimax.com/v1"
}
}
Research the configuration file locations for:
Update them with the active provider's API key and base URL manually.
| Action | Script | Connectivity Check |
|---|---|---|
| Add provider | add_provider.sh | No |
| List all | list_providers.sh | No |
| List by app | list_providers.sh --app <app> | No |
| Switch provider | switch_provider.sh | Yes (pre-flight) |
| Switch (skip test) | switch_provider.sh --skip-test | No |
| Delete provider | delete_provider.sh | No |
| Test connectivity | test_connectivity.sh | Yes (explicit) |
List available presets:
jq '.presets[] | select(.name)' ~/.Codex/skills/cc-switch/presets.json
Add your credentials:
~/.Codex/skills/cc-switch/scripts/add_provider.sh \
--name "My Provider" \
--app Codex \
--key "sk-xxxx" \
--url "https://api.example.com/v1"
Test before switching:
~/.Codex/skills/cc-switch/scripts/test_connectivity.sh --app Codex --name "My Provider"
Switch (with automatic test):
~/.Codex/skills/cc-switch/scripts/switch_provider.sh --app Codex --name "My Provider"
List all providers across all apps:
~/.Codex/skills/cc-switch/scripts/list_providers.sh
Switch different providers for different apps:
~/.Codex/skills/cc-switch/scripts/switch_provider.sh --app Codex --name MiniMax
~/.Codex/skills/cc-switch/scripts/switch_provider.sh --app codex --name AnotherProvider
Ensure the skill is installed in ~/.Codex/skills/cc-switch/ and scripts are executable:
chmod +x ~/.Codex/skills/cc-switch/scripts/*.sh
Double-check the provider name when using --name flag:
~/.Codex/skills/cc-switch/scripts/list_providers.sh
If you see unexpected mode:
# Check if cc-switch database exists
ls -la ~/.cc-switch/cc-switch.db
# Or check standalone directory
ls -la ~/.cc-switch-skill/
Check:
If you want to switch despite test failure, use --skip-test flag:
~/.Codex/skills/cc-switch/scripts/switch_provider.sh --app Codex --name Provider --skip-test
All scripts source scripts/common.sh which provides:
detect_mode())list_providers(), get_provider_by_name(), etc.)sqlite_*)standalone_*)generate_uuid(), get_provider_credentials())You can install or uninstall cc-switch at any time:
No migration needed - the skill adapts to whatever is available.