jackMort / jackMort/ChatGPT.nvim

api_key_cmd is ignored if OPENAI_API_KEY is set

Open
#452 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Lua
Stars
4k
Forks
317
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

No file or test is named in the issue. Trace how api_key_cmd and OPENAI_API_KEY are resolved, reproduce the behavior with both settings present, and add a regression test showing that the configured command takes precedence.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim
Domain
authentication
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.