A lightweight Windows GUI application for quickly switching Claude Code API keys, providers, base URLs, and models.
Key Switcher uses an Excel file to store API keys and a providers.json file to manage provider-specific configuration. When you click APPLY, the selected configuration is written directly to the Claude Code settings.json file.
- 🔑 Store and manage multiple API keys
- 🏷️ Give each API key a custom nickname
- 🔌 Support multiple providers
- 🤖 Provider-specific model lists
- 🌐 Provider-specific base URLs
- ⚡ Quickly switch between API keys and models
- 📝 Automatically update Claude Code
settings.json - 📊 Store API keys in an Excel file
- ⚙️ Edit providers and models from the application
- 🗑️ Delete saved API keys
- 🚫 No backup files are created
- 🎯 Simple main interface with only the required controls
Key Switcher uses three main configuration sources:
┌──────────────────┐
│ keys.xlsx │
│ │
│ Provider │
│ Nickname │
│ API Key │
└────────┬─────────┘
│
▼
Selected Nickname
│
▼
Find Provider
│
▼
┌──────────────────┐
│ providers.json │
│ │
│ Base URL │
│ Models │
└────────┬─────────┘
│
▼
Selected Model
│
▼
┌──────────────────┐
│ settings.json │
│ │
│ Auth Token │
│ Base URL │
│ Model Settings │
└──────────────────┘
The provider is not selected from the main interface.
Instead:
- You select a Nickname.
- Key Switcher finds the provider associated with that nickname in
keys.xlsx. - It loads that provider's models from
providers.json. - You select a model.
- Clicking APPLY updates Claude Code's
settings.json.
A typical project structure is:
Key Switcher/
│
├── Switcher_v2.py
├── providers.json
└── README.md
The Excel key file is stored separately:
C:\My Space\Data\keys.xlsx
Claude Code's settings file is:
C:\Users\Nishant\.claude\settings.json
Python 3.10+ is recommended.
Check your Python installation:
python --versionInstall the required packages with:
pip install PySide6 openpyxlThe application uses:
- PySide6 — GUI
- openpyxl — Excel file management
- json — provider/settings configuration
- pathlib — file path management
json and pathlib are included with Python.
Clone or download the project.
Then open a terminal in the project directory:
cd "C:\path\to\Key Switcher"Install dependencies:
pip install PySide6 openpyxlRun the application:
python Switcher_v2.pyAPI keys are stored in:
C:\My Space\Data\keys.xlsx
The Excel file contains only three columns:
| Provider | Nickname | API Key |
|---|---|---|
| Ollama | Ollama Main | your-api-key |
| Hugging Face | HF Key | your-api-key |
The application does not store the model or base URL in Excel.
Those values come from providers.json.
The provider is stored with each key so that Key Switcher knows which provider configuration to use.
providers.json is located in the same directory as the Python application.
Example:
{
"providers": {
"Ollama": {
"base_url": "https://ollama.com",
"models": [
"gemma4:31b",
"gpt-oss:120b",
"gpt-oss:20b",
"nemotron-3-nano:30b",
"nemotron-3-super",
"nemotron-3-ultra"
]
},
"Hugging Face": {
"base_url": "https://router.huggingface.co/v1",
"models": [
"Qwen/Qwen3.8-27B"
]
}
}
}Each provider contains:
Provider
├── base_url
└── models
The base_url is provider-wide.
For example:
"Ollama": {
"base_url": "https://ollama.com"
}All keys belonging to Ollama use that base URL.
Similarly:
"Hugging Face": {
"base_url": "https://router.huggingface.co/v1"
}All Hugging Face keys use that base URL.
Open the application and click the:
⋮
menu.
Select:
Provider Settings
From there you can edit the provider configuration.
You can:
- Change the Base URL
- Add models
- Delete models
The changes are saved directly to:
providers.json
Click:
⋮
Then select:
Add Key
The application asks for:
- Provider
- Nickname
- API Key
Example:
Provider: Ollama
Nickname: My Ollama
API Key: ********
The resulting Excel row is:
Ollama | My Ollama | ********
The main interface contains:
Nickname: [ My Ollama ▼ ]
Model: [ gemma4:31b ▼ ]
⋮ APPLY
When you select a nickname, the application automatically determines the provider.
For example:
Nickname
│
▼
My Ollama
│
▼
Provider = Ollama
│
▼
providers.json
│
├── Base URL
│
└── Models
The model dropdown is then populated with the models configured for that provider.
After selecting:
Nickname
and:
Model
click:
APPLY
The application updates:
C:\Users\Nishant\.claude\settings.json
The following environment variables are updated:
ANTHROPIC_AUTH_TOKEN
ANTHROPIC_BASE_URL
ANTHROPIC_MODEL
ANTHROPIC_SMALL_FAST_MODEL
ANTHROPIC_DEFAULT_SONNET_MODEL
ANTHROPIC_DEFAULT_OPUS_MODEL
ANTHROPIC_DEFAULT_HAIKU_MODEL
Suppose keys.xlsx contains:
Provider Nickname API Key
Ollama Work abc123
Hugging Face Testing xyz789
And providers.json contains:
{
"providers": {
"Ollama": {
"base_url": "https://ollama.com",
"models": [
"gemma4:31b",
"gpt-oss:120b"
]
},
"Hugging Face": {
"base_url": "https://router.huggingface.co/v1",
"models": [
"Qwen/Qwen3.8-27B"
]
}
}
}If you select:
Nickname: Work
Model: gpt-oss:120b
Key Switcher determines:
Provider = Ollama
Base URL = https://ollama.com
API Key = abc123
Model = gpt-oss:120b
Then it writes those values to Claude Code.
The application modifies the existing:
C:\Users\Nishant\.claude\settings.json
It preserves the other existing settings and updates the env section.
For example:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your-api-key",
"ANTHROPIC_BASE_URL": "https://ollama.com",
"ANTHROPIC_MODEL": "gpt-oss:120b",
"ANTHROPIC_SMALL_FAST_MODEL": "gpt-oss:120b",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-oss:120b",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "gpt-oss:120b",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-oss:120b"
}
}Other settings already present in settings.json are preserved.
The Key Manager provides:
Adds a new provider, nickname, and API key to keys.xlsx.
Deletes the currently selected nickname from keys.xlsx.
Opens the provider configuration editor.
API keys are stored locally in:
C:\My Space\Data\keys.xlsx
They are not intentionally uploaded by Key Switcher to a remote server.
However, anyone who can access the Excel file may be able to read the API keys.
Protect the Excel file and your Windows account appropriately.
Do not commit keys.xlsx containing real API keys to Git.
Add it to .gitignore:
keys.xlsx
*.xlsxYou should also avoid committing real API keys anywhere in the repository.
Key Switcher intentionally does not create backup copies of:
settings.json
or:
keys.xlsx
When changes are applied, the existing file is updated directly.
Make sure your important configuration is recoverable before making changes.
The application handles several common errors.
If this file does not exist:
C:\Users\Nishant\.claude\settings.json
the application will show an error.
If keys.xlsx is open in Microsoft Excel while trying to add or delete a key, close the Excel file and try again.
If settings.json or providers.json contains invalid JSON, the application reports the problem instead of applying the configuration.
If a provider stored in keys.xlsx does not exist in providers.json, the model list cannot be loaded and the application reports the missing provider.
If the selected provider has no base_url, the application will not apply the configuration.
The complete configuration flow is:
┌──────────────┐
│ keys.xlsx │
└──────┬───────┘
│
Nickname
│
▼
┌─────────────────┐
│ Find Provider │
└────────┬────────┘
│
▼
┌─────────────────┐
│ providers.json │
└───────┬─────────┘
│
┌────────┴────────┐
│ │
Base URL Models
│ │
│ ▼
│ Model Dropdown
│ │
└────────┬────────┘
│
APPLY
│
▼
┌───────────────────┐
│ settings.json │
└───────────────────┘
The main interface intentionally contains only:
Nickname
Model
⋮ APPLY
The provider is hidden from the main interface because it is automatically determined from the selected nickname.
The application separates key storage from provider configuration.
Responsible for:
Provider
Nickname
API Key
Responsible for:
Provider
Base URL
Models
Responsible for:
Claude Code environment configuration
This makes it possible to use multiple keys for the same provider without duplicating the provider's model and base URL configuration.
You can have multiple keys for the same provider:
Provider Nickname API Key
Ollama Personal key-1
Ollama Work key-2
Ollama Testing key-3
All three automatically use:
"Ollama": {
"base_url": "https://ollama.com",
"models": [...]
}You can also have keys for different providers:
Provider Nickname API Key
Ollama Personal key-1
Ollama Work key-2
Hugging Face HF Testing key-3
Selecting HF Testing automatically switches the available model list to the models configured under Hugging Face.
Check that:
- The nickname exists in
keys.xlsx. - The provider is correctly written in the
Providercolumn. - The provider exists in
providers.json. - The provider has at least one model.
Check:
settings.jsonexists.settings.jsoncontains valid JSON.- The selected nickname has an API key.
- The nickname has a provider.
- The provider exists in
providers.json. - The provider has a valid
base_url. - The selected model exists.
Close keys.xlsx in Excel and restart Key Switcher if necessary.
From the project directory:
python Switcher_v2.pyIf the Python command is not available, try:
py Switcher_v2.pyPossible future improvements include:
- System tray support
- Global keyboard shortcuts
- Searchable model list
- Import/export provider configurations
- Encrypted API-key storage
- Windows executable build
- Automatic Claude Code restart/reload
- Connection testing
- Provider status indicators
- Dark/light theme support
Add your preferred license here.
For example:
MIT License
if you decide to release the project under the MIT License.
Key Switcher provides a simple way to manage multiple Claude Code API configurations.
The architecture is:
keys.xlsx
│
├── Provider
├── Nickname
└── API Key
│
▼
providers.json
│
├── Base URL
└── Models
│
▼
settings.json
│
├── API Key
├── Base URL
└── Model Configuration
Select a nickname, select a model, and press APPLY to switch the Claude Code configuration.