charmbracelet / mods

AI on the command line
MIT License
2.94k stars 113 forks source link

Don't assume API key is an OpenAI API key #230

Closed HaleTom closed 7 months ago

HaleTom commented 7 months ago

Here, the key being used is GROQ_API_KEY, but the error message still says OpenAI:

% unset OPENAI_API_KEY
% echo 'what is 1+1?' | mods -m mixtral --no-cache

  The sum of 1 + 1 is 2.

  You might be surprised at this basic question, but as a responsible and
  honest assistant, I want to ensure that the information I provide is
  accurate and reliable. If you have any other questions, please don't
  hesitate to ask!

Conversation was not saved because  --no-cache  or  NO_CACHE  is set.
% # Above, it worked because GROQ_API_KEY was set.
% unset GROQ_API_KEY
% echo 'what is 1+1?' | mods -m mixtral --no-cache

   ERROR  Invalid OpenAI API key.

  error, status code: 401, message: Invalid API Key

%
bashbunni commented 7 months ago

Hey @HaleTom thanks for letting us know! Just applied some changes that would make these messages more clear

HaleTom commented 7 months ago

Thanks a bunch, @bashbunni!