chenfei-wu / TaskMatrix

Other
34.52k stars 3.32k forks source link

OpenAI API key: dont work on free account #53

Closed andzejsp closed 1 year ago

andzejsp commented 1 year ago

Not an issue but to let people like myself not waste 4h of their time downloading 60GiBs of data just to get to the point where, the API key you thought you had on your free account, does not work:

Entering new AgentExecutor chain...
Retrying langchain.llms.openai.completion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised RateLimitError: You exceeded your current quota, please check your plan and billing details..

Turns out you cant use openAI API on your free account.

Well, atleast i got to the gradio page. Good luck to all of you bois!

shashanoid commented 1 year ago

Are you on a mac?

Comdriver commented 1 year ago

It definitely works with free OpenAI account, I have free one and able to run this with only one issue - my GPU RAM capacity. Just keep in mind that free account is limited in requests.

andzejsp commented 1 year ago

Where do you get the API key from then? Can you Link The Pag? I just generated mine and I have never used it before but it threw me this error

ind1-go commented 1 year ago

Could you please help me, where and how shall I iput my OPENAI KEY?

I have the following error: "ValidationError: 1 validation error for OpenAI root Did not find openai_api_key, please add an environment variable OPENAI_API_KEY which contains it, or pass openai_api_key as a named parameter. (type=value_error)"

I use MACOS

FoehnWorknet commented 1 year ago

אני גם לא יודע מה ה-API של החשבון שלך, המקור תקין או לא...

wjwpoi commented 1 year ago

Could you please help me, where and how shall I iput my OPENAI KEY?

I have the following error: "ValidationError: 1 validation error for OpenAI root Did not find openai_api_key, please add an environment variable OPENAI_API_KEY which contains it, or pass openai_api_key as a named parameter. (type=value_error)"

I use MACOS

Add this in the visual_chatgpt.py: os.environ["OPENAI_API_KEY"] = "{your_openai_key}"

I hope this will help you.

Comdriver commented 1 year ago

@andzejsp @ind1-go @FoehnWorknet I got my key here: https://platform.openai.com/account/api-keys api But make sure you still have some requests available here: https://platform.openai.com/account/usage api2

And because I use Windows 10 for my AI learning, I had to change command to set API from export OPENAI_API_KEY={Your_Private_Openai_Key} to internal Anaconda env varibale: conda env config vars set OPENAI_API_KEY={Your_Private_Openai_Key} I believe that should work for any OS, because it is internal variable for conda environment.

изображение

andzejsp commented 1 year ago

@Comdriver thank you, yes i got the key from that page too, but i didnt check the usage. Turns out i have zero. How so? I have never used the API before. I have spent my dalle credits before, but other than that i never used the API

image

Comdriver commented 1 year ago

@andzejsp It is available for a limited time, like a few months, may be your account is too old

computerpsychologist commented 1 year ago

My api key with free account was disabled after committing it on Github. Does this mean it's not possible to deploy and test a chatgpt program in a production environment?

hack3y commented 1 year ago

hi all can someone help me with that, when im local, the chatgpt works well, and when i export it to private github it works , but when i push it to public github, it automatically deletes the API key from my openai account, i tried many solutions for example config.py and .gitignore so it dont push the config file but stills, and my computer is not reading the environment variable of the OPENai

hack3y commented 1 year ago

it did the same to me, you're deploying it on public thats why , you can deploy on private and it will work, but you can't share it with others unless you give permission to another github user, im searching for a solutions so i can hide the API key then it should work

Gictor97 commented 1 year ago

It will work with your free openai acconut unless its rate limit is reached.

andzejsp commented 1 year ago

It will work with your free openai acconut unless its rate limit is reached.

Stop these lies! I told you i never used any api from openai and my account did not have this enabled

jakesant commented 1 year ago

@andzejsp Please do not label other users' advice as "lies". Everyone here is only trying to help you in resolving your problem. Please be respectful.

You are definitely able to generate an API key from OpenAI on a free account. However the free credits are only valid for 3 months starting from the day you created your OpenAI account. This is automatically behaviour and that timer starts counting down even if you never went on the OpenAI Playground or even opened the API key page.

It is likely the 3 months time had passed by the time you got to using this.

OpenAI does not make it that obvious that you are given the credits the day you create an account. They really should make that clear because I encountered the same problem.

DALL-E credits are a separate system. The usage there won't affect your OpenAI usage with GPT.

luissalcedo commented 1 year ago

In order to use the OpenAI API you need to setup a pid account Screenshot from 2023-07-30 19-51-55

JUSTSUJAY commented 1 year ago

Openai API keys are valid for up to 3 months or until you run out of usage of $5. If you have completed 3 months of trial, your usage will be 0 and hence the keys can no longer be used. If you want, create a new account and generate new keys.

JUSTSUJAY commented 1 year ago

In order to use the OpenAI API you need to setup a pid account Screenshot from 2023-07-30 19-51-55

You can create a new account and it will give you $5 usage.

jakesant commented 1 year ago

@JUSTSUJAY Just so you know, creating a new account and verifying with the same phone number will not give you more free API credits. I tried that a while ago and it just considers your API account to be the same.

JUSTSUJAY commented 1 year ago

@JUSTSUJAY Just so you know, creating a new account and verifying with the same phone number will not give you more free API credits. I tried that a while ago and it just considers your API account to be the same.

I created my account in 2021, ig they didn't take my number back then so it works for me now.

Shantanu29kumar commented 1 year ago

I have created a new account and was unable to use my free credits as it was always showing ratelimiterror but then I saw a video that rather than saving it in your environment variables you can store it in your code itself import os os.environ['OPENAI_API_KEY']='yourAPIkey'

and all set then you can you use your free credits

JUSTSUJAY commented 1 year ago

I have created a new account and was unable to use my free credits as it was always showing ratelimiterror but then I saw a video that rather than saving it in your environment variables you can store it in your code itself import os os.environ['OPENAI_API_KEY']='yourAPIkey'

and all set then you can you use your free credits

Yeah, you can do that but it will expose your keys when you share your code.

Shantanu29kumar commented 1 year ago

I have created a new account and was unable to use my free credits as it was always showing ratelimiterror but then I saw a video that rather than saving it in your environment variables you can store it in your code itself import os os.environ['OPENAI_API_KEY']='yourAPIkey' and all set then you can you use your free credits

Yeah, you can do that but it will expose your keys when you share your code.

Definitely that's why it's recommended to hide it or remove it while sharing the code.

eleshinlomo commented 11 months ago

I solved this with these steps: Step 1: Comment out your API Key in .env. Step 2: Run your app with the commented out API and the app will throw error that no oepnai key found Step 3: Stop your server (Control C) Step 4: Uncomment your OpenAI Key Step 5: Start your server and this should work if indeed your plan is still valid