Closed tocer closed 1 year ago
Have you configured your access_token?
I found that my English README is not the latest version. I will update it later, or you can try the Chinese documentation first.
README_en updated @tocer
Have you configured your access_token?
yes, it's a free acount but not a plus account. account.ini
[chatgpt_1]
email=tocer.deng@gmail.com
access_token=sk-qNog77FnOeFBesY0PPQmT3BlbkFJRsFQkKtwEthHqYaXXXXX
config.ini
[redis]
host=redis
port=6379
db=0
[api_key]
api_keys=[
"sk-test",
"sk-2"
]
the access_token is not the API key. Open the url https://chat.openai.com/api/auth/session and login, then you can see the access_token.
Good, I have fixed the access_token error and test it, then seems to be blocked :(
$curl http://127.0.0.1:8082/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer sk-test" -d '{ "model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Hello!"}] }'
2023-05-13T08:58:06.804526272Z Traceback (most recent call last):
2023-05-13T08:58:06.804986879Z File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 668, in check_response
2023-05-13T08:58:06.805027285Z response.raise_for_status()
2023-05-13T08:58:06.805044934Z File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
2023-05-13T08:58:06.805060941Z raise HTTPError(http_error_msg, response=self)
2023-05-13T08:58:06.805076297Z requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://ai.fakeopen.com/api/conversation
2023-05-13T08:58:06.805631198Z
2023-05-13T08:58:06.805764993Z The above exception was the direct cause of the following exception:
2023-05-13T08:58:06.805791900Z
2023-05-13T08:58:06.805805463Z Traceback (most recent call last):
2023-05-13T08:58:06.807514508Z File "/usr/local/lib/python3.11/site-packages/gevent/pywsgi.py", line 999, in handle_one_response
2023-05-13T08:58:06.807553656Z self.run_application()
2023-05-13T08:58:06.807606677Z File "/usr/local/lib/python3.11/site-packages/gevent/pywsgi.py", line 946, in run_application
2023-05-13T08:58:06.807624423Z self.process_result()
2023-05-13T08:58:06.807637219Z File "/usr/local/lib/python3.11/site-packages/gevent/pywsgi.py", line 930, in process_result
2023-05-13T08:58:06.807650559Z for data in self.result:
2023-05-13T08:58:06.807663208Z File "/usr/local/lib/python3.11/site-packages/werkzeug/wsgi.py", line 281, in next
2023-05-13T08:58:06.807676933Z return self._next()
2023-05-13T08:58:06.807689364Z ^^^^^^^^^^^^
2023-05-13T08:58:06.807701842Z File "/usr/local/lib/python3.11/site-packages/werkzeug/wrappers/response.py", line 31, in _iter_encoded
2023-05-13T08:58:06.807715645Z for item in iterable:
2023-05-13T08:58:06.807741928Z File "/app/ChatGPTServer.py", line 135, in send_chunked_response
2023-05-13T08:58:06.807751601Z raise e
2023-05-13T08:58:06.807761284Z File "/app/ChatGPTServer.py", line 131, in send_chunked_response
2023-05-13T08:58:06.807773845Z yield from self.execute_chat_response(chatbot, scene_id, email, stream, message, conversation_id, parent_id, model)
2023-05-13T08:58:06.807786126Z File "/app/ChatGPTServer.py", line 91, in execute_chat_response
2023-05-13T08:58:06.807797456Z for data in chatbot.ask(prompt=message, conversation_id=conversation_id, parent_id=parent_id, model=model):
2023-05-13T08:58:06.807810431Z File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 556, in ask
2023-05-13T08:58:06.807821315Z yield from self.post_messages(
2023-05-13T08:58:06.807831832Z File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 510, in post_messages
2023-05-13T08:58:06.807842975Z yield from self.__send_request(
2023-05-13T08:58:06.807852609Z File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 365, in send_request
2023-05-13T08:58:06.807880825Z self.__check_response(response)
2023-05-13T08:58:06.807895999Z File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 66, in wrapper
2023-05-13T08:58:06.807907776Z out = func(*args, **kwargs)
2023-05-13T08:58:06.807917662Z ^^^^^^^^^^^^^^^^^^^^^
2023-05-13T08:58:06.807928471Z File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 675, in check_response
2023-05-13T08:58:06.807938736Z raise error from ex
2023-05-13T08:58:06.808658085Z revChatGPT.typings.Error: OpenAI: <!DOCTYPE html>
2023-05-13T08:58:06.808695023Z
2023-05-13T08:58:06.808709182Z
2023-05-13T08:58:06.808722832Z
2023-05-13T08:58:06.808734741Z
2023-05-13T08:58:06.808747589Z
2023-05-13T08:58:06.808758807Z This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data. You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.Sorry, you have been blocked
2023-05-13T08:58:06.809102398Z You are unable to access fakeopen.com
2023-05-13T08:58:06.809113676Z Why have I been blocked?
2023-05-13T08:58:06.809288094Z
2023-05-13T08:58:06.809301715Z What can I do to resolve this?
2023-05-13T08:58:06.809372442Z
2023-05-13T08:58:06.809382697Z
This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.
2023-05-13T09:18:45.272644012ZYou can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.
2023-05-13T09:18:45.272688016Zmy chatgpt works well, and is not blocked.
@tocer I just tested it locally and didn't encounter this issue. If you're still experiencing problems, you can try to run the proxy by yourself. Please refer to the following docker-compose.yml file:
version: '3'
services:
app:
image: beckjiang/chatgpt-api
container_name: chatgpt_api
restart: unless-stopped
ports:
- '8082:8082'
volumes:
- ./config:/app/config
environment:
CHATGPT_BASE_URL: http://go-chatgpt-api:8080/
depends_on:
redis:
condition: service_healthy
redis:
image: redis
ports:
- "6379"
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
retries: 5
go-chatgpt-api:
container_name: go-chatgpt-api
image: linweiyuan/go-chatgpt-api
environment:
- GIN_MODE=release
- GO_CHATGPT_API_PROXY=socks5://192.168.3.5:1086
# - GO_CHATGPT_API_PROXY=socks5://chatgpt-proxy-server-warp:65535
# depends_on:
# - chatgpt-proxy-server-warp
restart: unless-stopped
# chatgpt-proxy-server-warp:
# container_name: chatgpt-proxy-server-warp
# image: linweiyuan/chatgpt-proxy-server-warp
# environment:
# - LOG_LEVEL=INFO
# restart: unless-stopped
If your operating environment requires a VPN to access ChatGPT, you need to modify the GO_CHATGPT_API_PROXY environment variable. For detailed configuration of go-chatgpt-api, please refer to: https://github.com/linweiyuan/go-chatgpt-api . socks5://192.168.3.5:1086
is my local proxy config, you should change to yours.
Hi: my box is manjaro linux, I followed the guide and run:
curl http://127.0.0.1:8082/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sk-test" \ -d '{ "model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Hello!"}] }'
error happen:
chatgpt_api | Traceback (most recent call last): chatgpt_api | File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 668, in check_response chatgpt_api | response.raise_for_status() chatgpt_api | File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status chatgpt_api | raise HTTPError(http_error_msg, response=self) chatgpt_api | requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://ai.fakeopen.com/api/conversation chatgpt_api | chatgpt_api | The above exception was the direct cause of the following exception: chatgpt_api | chatgpt_api | Traceback (most recent call last): chatgpt_api | File "/usr/local/lib/python3.11/site-packages/gevent/pywsgi.py", line 999, in handle_one_response chatgpt_api | self.run_application() chatgpt_api | File "/usr/local/lib/python3.11/site-packages/gevent/pywsgi.py", line 946, in run_application chatgpt_api | self.process_result() chatgpt_api | File "/usr/local/lib/python3.11/site-packages/gevent/pywsgi.py", line 930, in process_result chatgpt_api | for data in self.result: chatgpt_api | File "/usr/local/lib/python3.11/site-packages/werkzeug/wsgi.py", line 281, in next chatgpt_api | return self._next() chatgpt_api | ^^^^^^^^^^^^ chatgpt_api | File "/usr/local/lib/python3.11/site-packages/werkzeug/wrappers/response.py", line 31, in _iter_encoded chatgpt_api | for item in iterable: chatgpt_api | File "/app/ChatGPTServer.py", line 135, in send_chunked_response chatgpt_api | raise e chatgpt_api | File "/app/ChatGPTServer.py", line 131, in send_chunked_response chatgpt_api | yield from self.execute_chat_response(chatbot, scene_id, email, stream, message, conversation_id, parent_id, model) chatgpt_api | File "/app/ChatGPTServer.py", line 91, in execute_chat_response chatgpt_api | for data in chatbot.ask(prompt=message, conversation_id=conversation_id, parent_id=parent_id, model=model): chatgpt_api | File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 556, in ask chatgpt_api | yield from self.post_messages( chatgpt_api | File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 510, in post_messages chatgpt_api | yield from self.send_request( chatgpt_api | File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 365, in send_request chatgpt_api | self.check_response(response) chatgpt_api | File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 66, in wrapper chatgpt_api | out = func(*args, **kwargs) chatgpt_api | ^^^^^^^^^^^^^^^^^^^^^ chatgpt_api | File "/usr/local/lib/python3.11/site-packages/revChatGPT/V1.py", line 675, in __check_response chatgpt_api | raise error from ex chatgpt_api | revChatGPT.typings.Error: OpenAI: {"detail":{"message":"Unauthorized - Invalid access token"}} (code: 401) chatgpt_api | Please check that the input is correct, or you can resolve this issue by filing an issue chatgpt_api | Project URL: https://github.com/acheong08/ChatGPT chatgpt_api | 2023-05-09T12:51:26Z {'REMOTE_ADDR': '::ffff:172.18.0.1', 'REMOTE_PORT': '50496', 'HTTP_HOST': '127.0.0.1:8082', (hidden keys: 23)} failed with Error chatgpt_api | chatgpt_api | ::ffff:172.18.0.1 - - [2023-05-09 12:51:26] "POST /v1/chat/completions HTTP/1.1" 500 161 1.040661
thanks for your any response.