Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

GenAIKeys

PyPI version CI License

Convenient, extensible API key management for Generative AI applications using cloud secret vaults. One Python API across Azure Key Vault, AWS Secrets Manager, and Google Secret Manager.

flowchart LR
    App[Your AI App] -->|sk.get| Cache{TTL Cache}
    
    subgraph GenAIKeys
        Cache
    end
    
    Cache -->|Cache miss| Azure[(Azure Key Vault)]
    Cache -->|Cache miss| AWS[(AWS Secrets)]
    Cache -->|Cache miss| GCP[(GCP Secret Manager)]

Why GenAIKeys?

  • One API, multiple vaults — swap providers without touching app code.
  • Keyless by default — Managed Identity, IAM roles, ADC.
  • TTL cache built in — fewer vault calls, lower bills.
  • Extensible — bring your own backend in a few lines.
  • Convenience helpers for OpenAI, Anthropic, and Gemini.

Install

pip install genaikeys              # Azure (default)
pip install "genaikeys[aws]"
pip install "genaikeys[gcp]"
pip install "genaikeys[all]"

Quick start

from genaikeys import GenAIKeys

sk = GenAIKeys.azure()                  # or .aws() / .gcp()

api_key       = sk.get("huggingface-api-key")
openai_key    = sk.get_openai_key()     # → "OPENAI-API-KEY"
anthropic_key = sk.get_anthropic_key()  # → "ANTHROPIC-API-KEY"
gemini_key    = sk.get_gemini_key()     # → "GEMINI-API-KEY"

Factory methods read defaults from the environment:

Backend Env var(s)
GenAIKeys.azure() AZURE_KEY_VAULT_URL
GenAIKeys.aws() AWS_DEFAULT_REGION, optional AWS_PROFILE
GenAIKeys.gcp() GOOGLE_CLOUD_PROJECT

Azure tip: Key Vault disallows underscores in secret names. GenAIKeys auto-converts _ → -, so sk.get("OPENAI_API_KEY") looks up OPENAI-API-KEY.

Working examples for each cloud live in examples/.

Documentation

Full docs are published at https://ndamulelonemakh.github.io/genaikeys/:

CLI

Populate a .env (or .env.example) file with values from your vault:

genaikeys fill .env --keyvault https://my-kv.vault.azure.net

Or go the other way — upload values from a .env into a vault:

genaikeys push .env --keyvault https://my-kv.vault.azure.net

Only empty values are filled by default; push skips keys that already exist. See docs/cli.md for all options (--backend, --overwrite, --dry-run, --strict, --only, --output, …).

Caching

sk = GenAIKeys.azure(cache_duration=300)   # 5-minute TTL
sk.clear("OPENAI_API_KEY")                 # invalidate one key
sk.clear()                                 # invalidate everything

Custom backends

from genaikeys import GenAIKeys
from genaikeys.plugins import SecretManagerPlugin

class MyPlugin(SecretManagerPlugin):
    def get_secret(self, secret_name: str) -> str:
        return "my-secret-value"

sk = GenAIKeys(MyPlugin())

See Custom backends for the full interface and entry-point registration.

Contributing

PRs welcome — see CONTRIBUTING.md and CHANGELOG.md.

License

MIT — see LICENSE.

Metadata

Release files for genaikeys 0.1.0rc5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genaikeys 0.1.0rc5
File Size Uploaded Provenance
genaikeys-0.1.0rc5.tar.gz 103.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for genaikeys 0.1.0rc5
File Interpreter ABI Platform
genaikeys-0.1.0rc5-py3-none-any.whl Python 3 none any Details

Total release size: 120.4 kB

Release files / genaikeys-0.1.0rc5.tar.gz

Download URL genaikeys-0.1.0rc5.tar.gz
Size 103.2 kB
Tags Source
SHA-256 checksum
How to use checksums
70c120358cebc9b895c62a089bda48b87d567d7b60185dbacd45a8e42608059d
BLAKE2b-256 checksum
How to use checksums
3d0193c9e2c84ddfdd9abbbc44352147eaa0048412eb5e4c4d279d08360962e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 20, 2026.

Transparency log

Release files / genaikeys-0.1.0rc5-py3-none-any.whl

Download URL genaikeys-0.1.0rc5-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58f2beeba9dadf73d2ae4ea54d6aa4cb18bf5484840c55cc230a42517b7c87e7
BLAKE2b-256 checksum
How to use checksums
18f4da886c1bb901ff729b1de8f27e8fd4c0a20046c3df9e3efb886f560cf633
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 20, 2026.

Transparency log

Security for genaikeys 0.1.0rc5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for genaikeys-0.1.0rc5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page