Open nithinreddyy opened 1 year ago
I had the same error on AWS EC2. The problem is that CloudFlare is denying access (error code: 1020) and module can't get the pre tag. As a solution, we used a proxy server that retrieves tags from outside the IP range outside of google colab(Google Cloud) or AWS and it worked.
# For example
PROXY = "your proxy"
api = ChatGPT(session_token, chrome_args=[
'--proxy-server=%s' % PROXY,
])
You can either set up your own proxy server or use one that randomly converts IPs, such as Tor. However, the latter is not recommended.
I had the same error on AWS EC2. The problem is that CloudFlare is denying access (error code: 1020) and module can't get the pre tag. As a solution, we used a proxy server that retrieves tags from outside the IP range outside of google colab(Google Cloud) or AWS and it worked.
# For example PROXY = "your proxy" api = ChatGPT(session_token, chrome_args=[ '--proxy-server=%s' % PROXY, ])
You can either set up your own proxy server or use one that randomly converts IPs, such as Tor. However, the latter is not recommended.
But i don't have any server here. How to use it on local pc, any idea??
Although it may not be a good practice, the following solution is available if you do not set up a proxy server. (but you will need to check to see if there are any legal issues)
install Tor (Debian system is used as an example)
apt-get -y update && apt-get install -y tor
run as follows (Example)
from pyChatGPT import ChatGPT
import subprocess
from subprocess import PIPE
session_token = "your token" tor = subprocess.Popen(["tor"], shell=True, stdout=PIPE, stderr=PIPE)
PROXY = "socks5://localhost:9050"
api = ChatGPT(session_token, chrome_args=[ "--proxy-server=%s'"% PROXY, ]) resp = api.send_message("Hello World")
tor.kill()
---
※ This may not be something that is explained in this repository, but that the API has been officially released(GPT-3), you may want to consider using it.
### API Key Page
https://beta.openai.com/account/api-keys
### Program Example
`pip install openai`
```python3
import openai
CHAT_GPT_SECRET = "your secret api key"
openai.api_key = CHAT_GPT_SECRET
response = openai.Completion.create(
model="text-davinci-003",
prompt="Hello World",
temperature=0,
max_tokens=3000
)
print(response.choices[0].text)
Although it may not be a good practice, the following solution is available if you do not set up a proxy server. (but you will need to check to see if there are any legal issues)
- install Tor (Debian system is used as an example)
apt-get -y update && apt-get install -y tor
- run as follows (Example)
from pyChatGPT import ChatGPT import subprocess from subprocess import PIPE session_token = "your token" tor = subprocess.Popen(["tor"], shell=True, stdout=PIPE, stderr=PIPE) # default IP PROXY = "socks5://localhost:9050" api = ChatGPT(session_token, chrome_args=[ "--proxy-server=%s'"% PROXY, ]) resp = api.send_message("Hello World") tor.kill()
※ This may not be something that is explained in this repository, but now that the API has been officially released, you may want to consider using it.
API Key Page
https://beta.openai.com/account/api-keys
Program Example
pip install openai
import openai CHAT_GPT_SECRET = "your secret api key" openai.api_key = CHAT_GPT_SECRET response = openai.Completion.create( model="text-davinci-003", prompt="Hello World", temperature=0, max_tokens=3000 ) print(response.choices[0].text)
ChatGPT API is not release yet right? I think the 2nd code which you wrote is for GPT-3
Sorry, I misunderstood. It is true that there may be a difference in accuracy due to the GPT-3 model, but the results are equivalent, so I think it is better to use the API. If you still want to use ChatGPT, you can use a proxy server as described above or anonymize your IP address using like Tor.
Sorry, I misunderstood. It is true that there may be a difference in accuracy due to the GPT-3 model, but the results are equivalent, so I think it is better to use the API. If you still want to use ChatGPT, you can use a proxy server as described above or anonymize your IP address using like Tor.
Tor option doesnt work - giving me same error as without it.
IPs of Google Colab and AWS are blocked. Consider using a proxy.
I have http proxy in format - ip:port:username:password How can I use it?
※ This may not be something that is explained in this repository, but now that the API has been officially released, you may want to consider using it.
API Key Page
https://beta.openai.com/account/api-keys
Program Example
pip install openai
import openai CHAT_GPT_SECRET = "your secret api key" openai.api_key = CHAT_GPT_SECRET response = openai.Completion.create( model="text-davinci-003", prompt="Hello World", temperature=0, max_tokens=3000 ) print(response.choices[0].text)
ChatGPT API is not release yet right? I think the 2nd code which you wrote is for GPT-3
The API is for davinci-3, which is similar but not the same as GPT-3. You need to keep sending the questions and answers if you have several questions. And the prices are terrible. The 18 USD you get are consumed very quickly.
They need to:
And then we can all abandon those tricky (but nice) solutions.
I'm having this issue too!
Below is the code i tried on Google Colab,
api = ChatGPT(secret_token)
It's returning error as below
Can anyone please help me with this?