Use AI to manage your Bitwarden API keys.
Project description
Bitwarden AI Key Manager (BAKM)
BAKM is a command-line interface (CLI) tool designed to streamline the management of AI model configurations by syncing them between a local LiteLLM-formatted YAML file and a Bitwarden vault.
It leverages Bitwarden's Secure Notes and Custom Fields to store model parameters, ensuring that sensitive information like API keys is kept secure. The tool also supports pulling configurations from Bitwarden and converting them into various formats, such as LiteLLM YAML, Claude Code Router JSON, or a generic JSON structure.
Features
- Sync to Bitwarden: Upload models from a
litellm_config.yamlto a specified folder in your Bitwarden vault. - Pull from Bitwarden: Fetch model configurations from Bitwarden.
- Multiple Output Formats: Convert pulled configurations into
litellm,claude-router, orjsonformats. - Secure Storage: Automatically stores
api_keyvalues in hidden custom fields within Bitwarden. - Easy Configuration: Uses a
.envfile to configure the target Bitwarden folder.
Prerequisites
- Python: Version 3.8 or higher.
- Bitwarden CLI: The
bwcommand-line tool must be installed and accessible in your system's PATH. You can find installation instructions here. For macOS users, you can install it using Homebrew:brew install bitwarden-cli
Installation
-
Clone the repository:
git clone <repository_url> cd BitwardnAiKeyManager
-
Install dependencies using
uv: This project usesuvfor dependency management. If you don't have it, install it first. Then, install the project in editable mode:uv pip install -e .
This will install all required packages and register the
bakmcommand in your shell.
Configuration
-
Log in to Bitwarden CLI: Before using the tool, you must be logged in to your Bitwarden account and your vault must be unlocked.
# Log in (only needs to be done once) bw login # Unlock your vault (session-based) bw unlock
-
Create a Bitwarden Folder: In your Bitwarden vault (either via the app or web vault), create a new folder to store your AI model configurations. For example, you can name it
AI_KEYS. -
Set up the Environment File: Create a
.envfile in the project root by copying the example file:cp .env.example .env
Edit the
.envfile and setBITWARDEN_FOLDER_NAMEto the exact name of the folder you created in the previous step.# .env BITWARDEN_FOLDER_NAME="AI_KEYS"
Usage
The CLI is available via the bakm command.
Sync to Bitwarden
The sync command reads a local litellm_config.yaml file and creates or updates corresponding Secure Notes in your Bitwarden vault.
# Sync using the default litellm_config.yaml in the current directory
bakm sync
# Sync using a specific config file
bakm sync --config /path/to/your/config.yaml
The tool will match models by the model_name field and either update existing entries or create new ones.
Pull from Bitwarden
The pull command fetches all model configurations from the specified Bitwarden folder and outputs them in the desired format.
1. Output as LiteLLM YAML (default):
bakm pull
Output:
model_list:
- model_name: openai/gpt-4o
litellm_params:
api_base: https://api.openai.com/v1/
api_key: sk-xxxx
model: gpt-4o
- model_name: azure/gpt-4o
litellm_params:
api_base: https://your-azure-deployment.openai.azure.com/
api_key: xxxxx
api_version: '2024-02-01'
model: azure/gpt-4o-2024-05-13
2. Output as Claude Code Router JSON:
bakm pull --format claude-router
3. Output as Generic JSON and Save to a File:
bakm pull --format json --out my_models.json
This will create a file named my_models.json with the configuration data.
Get Help
For a full list of commands and options, use the --help flag.
bakm --help
bakm sync --help
bakm pull --help
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bitwardnaikeymanager-0.1.0.tar.gz.
File metadata
- Download URL: bitwardnaikeymanager-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a2e7ca4869c9f4f1695a1294ff696e28799c0254ff1e2575c8ea257b2b1c869
|
|
| MD5 |
55529053d626000b3072c5569ca42fc3
|
|
| BLAKE2b-256 |
e9cde359680c3a5b40bc8b94c40dac24e5517887c751d105be8957e7953844a1
|
File details
Details for the file bitwardnaikeymanager-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bitwardnaikeymanager-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9aa6002ea916a9b79f2b87443b06172edf9c5313badedf24729913f9050ef6d
|
|
| MD5 |
6449502a21cee0e0f079cc6b46fbdcf2
|
|
| BLAKE2b-256 |
3b66229ed5557669c1333bad99caa350f8a69e1d02c9a8fc80914996be0dc414
|