Go-to solution for effortless secret keys management. This lib/tool allows you to securley store (once for all!) and swiftly load secret key-value pairs from a local cache using dotenv file logic. Now, accessing your favorite API keys across all your projects is as simple as saying hello.
Run this anywhere in your computer to safely store a key on disk
$ keyenv -n {service name} -sk {secret key}
You can of course update a service's key anytime, or list all services
$ keyenv update -n {service name} -sk {new secret key}
$ keyenv list # this will list all service names
You can also provide path to a json
file to store/update commands
$ keyenv store -p {path/to/json}
$ keyenv update -p {path/to/json}
You could also perform same actions from a Python script if needed
import keyenv as kv
kv.store(service="secret")
kv.update(service="secret")
kv.store("path/to/json/keys")
print(kv.list())
You can then access all of your keys with keyenv.get(service)
in your Python code 🥳
import langchain.llms as llms
import keyenv as kv
os.environ["OPENAI_API_KEY"] = kv.get("openai")
llm = llms.OpenAI()
llm_chain = LLMChain(prompt="Hi my name is", llm=llm)
llm_chain.run()
🚨 To install keyenv
, use pip: pip install keyenv
.