-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safe and pragmatic way to use API key #6
Comments
They could do this with Having said all that...
Agreed. Here's where |
Yeah I'm not a huge fan of the environment variable thing either. I'd like to make this double as an LLM plugin - if you install both this and LLM in the same environment you could run This tool uses a different incompatible version of the OpenAI Python library though so I'd need to fix that first: |
With something like 1password-cli, or basically anything that allows fetching a credential from the command line, there is a simple workaround for interactive shells: making a function wrapper. ospeak() {
local token="${OPENAI_API_KEY:-}"
if [[ -z $token && $1 != "--help" && $1 != "--version" ]]; then
token="$(op read 'op://Personal/OpenAI API Key/api key')" || return 1
fi
OPENAI_API_KEY="$token" command ospeak "$@"
} Explanation: the With this approach, OPENAI_API_KEY is only ever 1) fetched on-demand, and 2) exported to the The downside, of course, is that every With macOS Keychain instead of 1Password, for example, the command to fetch the credential could be as following: security find-generic-password -s api.openai.com -w |
I am concerned about setting my openai API key as global env. WIl other packages be able to use it without my confirmation?
I like how llm manages it with "llm keys set openai". It would be great to have here the same.
The text was updated successfully, but these errors were encountered: