Nutlope / aicommits

A CLI that writes your git commit messages for you with AI

Home Page:https://www.npmjs.com/package/aicommits

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to Set OpenAI API Key

RayChang opened this issue · comments

Bug description

I reinstalled aicommits globally using pnpm (8.11.0) and added the OpenAI_KEY in the settings. However, when I attempted to make a git commit using aicommits, I encountered an OpenAI API Error: 401 - Unauthorized message.

2023-12-01 11 30 27

Expected Behavior: Should be able to generate commit messages normally through aicommits.

aicommits version

1.11.0

Environment

System:
  OS: macOS 14.1.1
  CPU: Apple M1 Max
  Shell: /bin/zsh (5.9)
Binaries:
  Node: v18.18.2 ~/.nvm/versions/node/v18.18.2/bin/node
  npm: 9.8.1 ~/.nvm/versions/node/v18.18.2/bin/npm
  pnpm: 8.11.0 /opt/homebrew/bin/pnpm

Can you contribute a fix?

  • I’m interested in opening a pull request for this issue.

I am encountering this bug too. When I use aicommits config set to set the API key, it sets it in the .aicommits file in my home directory. However, it is not preferring that setting over an ENV variable. I have an ENV variable set (OPENAI_KEY) that is empty string, and it is attempting to use that instead of the value set in .aicommits.

Ay,

I have the same issue and I still can't find from where the OPENAI_KEY variable is set. And .aicommits config does not seem to be taken into account with my new OpenAI API key.

What's the state about this issue? I'm having the same issue and can't identify where the OPENAI_KEY is defined.

Okay, for which reason it was configured with export OPENAI_KEY=XYZ in my .zshrc ... nevermind ;)
A grep --recursive 'sk-XYZ' ./ helps