Skip to content
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

api_key_cmd is ignored if OPENAI_API_KEY is set #452

Open
lukeemhigh opened this issue Jul 1, 2024 · 3 comments
Open

api_key_cmd is ignored if OPENAI_API_KEY is set #452

lukeemhigh opened this issue Jul 1, 2024 · 3 comments

Comments

@lukeemhigh
Copy link

I use op as my api_key_cmd, but this only works if the OPENAI_API_KEY env var is not set.

I have exported my OPENAI_API_KEY to "op://Personal/OPENAI_API_KEY/credential" to be able to use the op run command to expand that variable and pass it to selected subprocesses, but this breaks the plugin because it seems that it defaults to get its api_key from env vars even if an api_key_cmd is set.

To me, the opposite behavior should be preferred.

@thiswillbeyourgithub
Copy link
Contributor

Ohhhhh Thanks a lot because your issue made me understand why I had issues with launching the app through SSH or not. It was because I was setting the environment viable in just one of the two cases. Thanks a lot.

@MrCee
Copy link

MrCee commented Jul 12, 2024

I'm interested to know if anything has changed. And I don't think we should need to set in two places although I have been needing to do this in the last few weeks.

What I can suggest is getting the api_key locally in lua first via a function, and then wiring it to api_key_cmd simply by echo.
api_key_cmd wants a command, so you may as well simply echo the response as a command. Have tried here: #454

@lukeemhigh
Copy link
Author

What I can suggest is getting the api_key locally in lua first via a function, and then wiring it to api_key_cmd simply by echo. api_key_cmd wants a command, so you may as well simply echo the response as a command. Have tried here: #454

Sorry for the late reply, but this seems promising. I'll look into it and get back sooner or later!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants