TheR1D / shell_gpt

A command-line productivity tool powered by AI large language models like GPT-4, will help you accomplish your tasks faster and more efficiently.
MIT License
9.78k stars 770 forks source link

Unable to use OpenAI API key #579

Open cody151 opened 5 months ago

cody151 commented 5 months ago

I created an API key in my dev dashboard yet sgpt refuses to use it saying "NotFoundError: Error code: 404 - {'error': {'message': 'The model gpt-4-1106-preview does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}" However, I do not have GPT-4 access I still should be able to use GPT-3.5?

Robinsane commented 5 months ago

You should probably look into setting the env variable "DEFAULT_MODEL". alternatively you can directly adjust it in config.py It used to be GPT-4 it tried to access by default, however very recently the default model it tries to call is gpt-4o

I believe your problem should be fixed if you fill in the correct model name to make calls to gpt-3.5

Nevga commented 3 months ago

I had the same error message. In my case, the solution was not to change the DEFAULT_MODEL variable but simply to sign up for API usage billing. Not to be confused with regular ChatGPT billing (free vs. plus). As the documentation states, there are costs for API usage.

These costs can be lower when you switch to older models, though. So I'd like to add that the model name for GPT 3.5 is not "gpt-3.5" but "gpt-3.5-turbo". See https://platform.openai.com/docs/models

One could add the following line to ~/.config/shell-gpt/.sgtprc:

DEFAULT_MODEL=gpt-3.5-turbo

Just in case someone has the same problems I had: I had to add my API-Key to the same file (as, for whatever reason, Shell-GPT didn't ask for my key on installation) by pasting the key after typing OPENAI_API_KEY=

Note to myself after needing an hour to complete the installation: The readme is - I think, on purpose, which seems fair enough to me - written for people with some knowledge concerning ChatGPT, Linux and Python. The problem is that all sorts of magazines present Shell-GPT as an easy-to-use software for everyone.

luigi370 commented 1 month ago

having similar use, authentication failure, but Im sure the api key is correct. 3 days ago was working fine.