GenAIKeys is a Python library that streamlines API key management for Generative AI applications by securely storing the keys in cloud secret vaults like Azure Key Vault, AWS Secrets Manager, and Google Secret Manager.
Disclaimer: Please exercise caution when using this package in production environments. We recommend that you review the codebase and ensure that it meets your security requirements before deploying it in a production environment.
- 🔐 Secure API key management for GenAI services
- 🚀 Zero environment variable configuration
- ⚡️ Direct integration with cloud secret vaults
- 🔌 Built-in support for OpenAI, Anthropic, and Google Gemini
- 🛠 Extensible architecture for custom secret backends
pip install genaikeys
from genaikeys import SecretKeeper
# Initialize GenAIKeys
skp = SecretKeeper.from_defaults()
# Get API keys directly
api_key = skp.get('huggingface-api-key')
# Use convenience methods
openai_key = skp.get_openai_key()
anthropic_key = skp.get_anthropic_key()
gemini_key = skp.get_gemini_key()
-
By default, GenAIKeys uses the
Azure Key Vault
secret backend. You can configure the secret backend by setting theSECRET_KEEPER_BACKEND
environment variable to one of the following values:AZURE
AWS
GCP
-
We recommend setting the
SECRET_KEEPER_BACKEND
environment variable in a persistent configuration file like.bashrc
or.zshrc
.* -
You will also need to provide the configurations for the secret backend you choose.
- The following environment variables are required for the
Azure Key Vault
secret backend:AZURE_KEY_VAULT_URL
- Optionally you can also provide the following environment variables:
MANGED_IDENTITY_CLIENT_ID
(for User Assigned Managed Identity authentication)
For detailed usage instructions, API reference, and advanced configuration options, visit our documentation.
We welcome contributions! Please see our contribution guidelines before submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.