plz-cli icon indicating copy to clipboard operation
plz-cli copied to clipboard

More info for error "Failed to get a response. Have you set the OPENAI_API_KEY variable?"

Open dylang opened this issue 2 years ago • 9 comments

Hi, looking forward to trying this, getting an error though and I'm not sure how to debug it.

The key is freshly made from https://beta.openai.com/account/api-keys. I'm using fish shell 3.5.1 in MacOS.

 ❯ echo $OPENAI_API_KEY
sk-<key hidden>
 ❯ plz "list files"
✖ Failed to get a response. Have you set the OPENAI_API_KEY variable?

I've yet to try to code in Rust so I'm not set up to try to modify the source and see what's happening.

dylang avatar Dec 14 '22 19:12 dylang

have the same issue @m1guelpf

yorhodes avatar Dec 14 '22 20:12 yorhodes

Having the same issue as well... image

omeb avatar Dec 14 '22 23:12 omeb

Same here (KDE Neon). Also having OPENAI_API_KEY variable persisted I think that it does not depend on setting OPENAI_API_KEY variable because plz do not let you run a request to OPENAI API without KEY variable. It shows the next message: This program requires an OpenAI API key to run. Please set the OPENAI_API_KEY environment variable. IDK if it is related to API permissions or whatever.

llunasanz avatar Dec 14 '22 23:12 llunasanz

I had problems with API_KEYS from my personal account as my account had not enough credit to make any request. You can confirm if you are able to make requests at https://beta.openai.com/playground (just make a dummy request there).

An API for accessing new AI models developed by OpenAI

jcortejoso avatar Dec 15 '22 00:12 jcortejoso

Having the same issue here

ghost avatar Dec 15 '22 06:12 ghost

I tried to provide billing details and set my credit card at OpenAI. Then, I repeated the steps and it worked for me:

image

Thanks to @jcortejoso for the message!

llunasanz avatar Dec 15 '22 09:12 llunasanz

Would be really helpful if anyone experiencing this issue could share a copy of the response returned, so I can improve the error message on the CLI

m1guelpf avatar Dec 15 '22 11:12 m1guelpf

I had the same problem, billing/playground showed "You've reached your usage limit." and it started working once I provided billing details. Thanks @jcortejoso and @llunasanz!

markkucler avatar Dec 15 '22 20:12 markkucler

also was just a billing issue for me

yorhodes avatar Dec 15 '22 23:12 yorhodes