zsodur/chatgpt-api-by-browser-script
Tentang
This project runs on users' browsers through the Tampermonkey script and converts the web version of ChatGPT operations into an API interface. This way, you can use GPT-4 in chatgpt web pages to play things like Auto-GPT. / 该项目通过Tampermonkey脚本在用户的浏览器上运行,并将ChatGPT操作的Web版本转换为API接口。这样,您就可以使用chatgpt网页中的GPT-4来玩Auto-GPT等内容。
Pengembangan web dan aplikasiYang dapat Anda lakukan
- If you have a chatgpt plus account, you can use gpt-4 api.
- Having unlimited context.
- Not easy to be banned and easier to handle errors.
Pertumbuhan bintang terukur
- dalam 24 jam
- -1
- dalam 7 hari
- 0
- dalam 15 hari
- 0
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliChatgpt API By Browser Script
This project runs on users' browsers through the Tampermonkey script and converts the web version of ChatGPT operations into an API interface. You can use this API to do some interesting things, such as playing Auto-GPT.
Update
2024-05-19: Support new version UI and gpt-4o.
Features
- API no cost.
- If you have a chatgpt plus account, you can use gpt-4 api.
- Having unlimited context.
- Not easy to be banned and easier to handle errors.

Usage
Step 1 Installation and Configuration
- Make sure your system has installed Node.js and npm.
- Clone this repository and run
npm installin the project directory to install dependencies. - Run
npm run startto start the Node.js server. - Alternatively, you can use Docker
docker-compose upto start the Node.js server.
Step 2 Use Tampermonkey
- Install Tampermonkey browser extension.
- Open Tampermonkey management panel and create a new script.
- Copy the contents of
tampermonkey-script.jsfile into the newly created script and save it.
Step 3 Download and Install the Browser Extension Disable Content-Security-Policy
Download from here
Step 4 Open and Log in to ChatGPT
If you see this in the upper right corner of the webpage, you have succeeded !

Step 5 Use API
You now have an API address: http://localhost:8766/v1/chat/completions
API Params
| Parameter | Description | Default | Required |
|---|---|---|---|
| messages | Refer to OpenAI API documentation | Yes | |
| model | No longer supported, please select model on the webpage. | ||
| stream | Refer to OpenAI API documentation | false | No |
Example of Request Parameters
{
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Who are you?"
}
],
"model": "gpt-4"
}
Play with Auto-GPT
Modify the llm_utils.py file in Auto-GPT.
import requests
# response = openai.ChatCompletion.create(
# model=model,
# messages=messages,
# temperature=temperature,
# max_tokens=max_tokens,
# )
response = requests.post("http://localhost:8766/v1/chat/completions", json={"messages": messages, "model": model, "newChat": False, "temperature": temperature, "max_tokens": max_tokens}).json()
# return response.choices[0].message["content"]
return response["choices"][0]["message"]["content"]
Jelajahi proyek terkait
Memuat…