This is a python client for node-gpt-api. (Only supports BingAI by now; welcome for PR!)
-
Python 3.7+ is required.
To render the querying resutls with
render.py
, installmarkdowngenerator
using pip:pip3 install git+https://github.com/Nicceboy/python-markdown-generator
-
Install node-gpt-api following official instructions
-
Config API server in
gpt_api/settings.js
. SetuserToken
/cookies
andproxy
(if necessary). Tips: visitedge://settings/siteData?search=cookie
in Edge for cookie.bingAiClient: { ... // The "_U" cookie value from bing.com userToken: '', // If the above doesn't work, provide all your cookies as a string instead cookies: '', // A proxy string like "http://<ip>:<port>" proxy: '', ... },
-
Luanch API server:
cd gpt_api chatgpt-api
-
Edit your questions in
gpt_client.py
. Responses will be saved toresults
as json files.# example usage questions_with_saving = \ [ {'q': "How is the air quality in NYC in 2023? Please provide some references.", # one question 'save_as': 'results/001_nyc.json'}, {'q': 'What about Boston?', 'save_as': 'results/002_boston.json'}, ] questions_without_saving = \ [ {'q': "How is the air quality in NYC in 2023? Please provide some references."}, # one question, {'q': 'What about Boston?'}, ] client = BingAIClient(host='127.0.0.1', port=3000, verbose=True, pacing_between_sessions_ms=2000) client.new_session() client.ask_questions(questions_with_saving) client.new_session() client.ask_questions(questions_without_saving)
python gpt_client.py
-
(Optinal) Render the responds as
results.md
python render.py
- Support BingAI
- Support ChatGPT