-
Notifications
You must be signed in to change notification settings - Fork 43.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API key not working? #66
Comments
You have to rename the file to just |
Might still not work properly I added some print() to debug and I'm getting this:
|
So you have a file called |
Yes, tried having it in both root and /scripts directory, with or without quotations marks around the key, to no avail Does it works on your end? |
renaming to .env worked for me
…On Mon, Apr 3, 2023 at 2:17 PM Toran Bruce Richards < ***@***.***> wrote:
So you have a file called .env that contains the keys? 🤔
—
Reply to this email directly, view it on GitHub
<#66 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZMQMJBPPRAR6MITGP4NDPLW7LEYDANCNFSM6AAAAAAWRH3RMY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Yep, must be in the root directory and no quotes. |
I have a .env file in the root directory, with python-dotenv library installed, with the full key "sk-XYZ..." without quotes, but I'm still getting this:
|
I'm unable to reproduce this.. Sorry! Try cloning a fresh copy and setup the .env file again. Are you using a virtual environment? |
No venv and on windows 11 22H2 What about you? |
Name: NextJS-13-Developer still broke Ive done everything you all spoke about to no avail HELP |
Hey, I just found a solution. As you can see, python scripts use First, check your value in a console. $ python
>>> import os
>>> api_key = os.getenv("OPENAI_API_KEY")
>>> print("OPENAI_API_KEY:", api_key)
OPENAI_API_KEY: <your API key> If the value is different from the value in the .env file, there might be a high possibility that an environment variable has already been set. $ printenv
...
OPENAI_API_KEY=<your API key> So by unsetting the value in $ unset OPENAI_API_KEY However, it is probably due to the fact that the environment variable values are fixed in the shell settings, so the best way is to update the value to the correct one. In my case, I used the wrong value that had been set up in // .zshrc
source "$HOME/.openai_key.zsh"
// .openai_key.zsh
export OPENAI_API_KEY=<wrong key> |
Which code should I type to fix the issue? |
Make sure that there's the value of $ printenv
...
OPENAI_API_KEY=<your API key> Remember the above key. If the different variable in // temporary solution
$ unset OPENAI_API_KEY The way of changing an environment variable depends on your environment, so I can't propose you a proper answer. |
Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
* expand faq * models * fix format error
https://i.imgur.com/JE5Gz8X.png
I have added API keys however it does not seem to work
The text was updated successfully, but these errors were encountered: