This project implements a Python web API that offers free access to three leading AI chatbots ChatGPT, Google Bard, and Claude through a single interface.
Key features:
- Unified API endpoints allow seamlessly querying ChatGPT, Google Bard, and Claude from one integration.
- Leverages the free web/browser versions of each AI service by managing cookies and sessions. Avoid costs of paid API access.
- Simple API for text completion, question answering, and conversational queries. Integrate AI capabilities easily.
- Lightweight Python server using FastAPI. Easily self-host locally or on your own infrastructure.
- Full support for streaming responses.
It's a personal project to use tools like ShellGPT and others.
- ✅ Google Bard integration available now.
- ✅ Claude-2 integration is also fully implemented and available.
- ✅ ChatGPT integration is fully complete and available now.
- Implement OpenAI endpoints for ChatGPT, (
v1/chat/completions
) - Use proxy
- Use multiple accounts
NOTE: This project is currently under active development.
First you need to add your tokens to the Config.conf
file (see Configuration section).
Google Bard
Google Bard:
Please obtain the cookies mentioned here from an authorized session on bard.google.com. The cookies can be used to
send POST requests to the /bard endpoint along with a message in a JSON payload. It is important that the session_id,
which is your Secure-1PSID cookie, is included in the request. (Screenshot)
- Login to bard.google.com
- Open
Developer Tools
(Press F12) - Go to
Application Tab
- Go to
Cookies Tab
- Copy the content of
__Secure-1PSID
- Set in Config.conf file.
Claude 2
Claude:
You can get cookie from the browser's developer tools network tab ( see for any claude.ai requests check out cookie ,copy whole value ) or storage tab ( You can find cookie of claude.ai ,there will be four values ) (Screenshot)
- Login to claude.ai/chats
- Open
Developer Tools
(Press F12) - Go to
Network Tab
- Select an ajax request (like step 3 in picture)
- Copy the content of
Cookie
- Set in Config.conf file.
ChatGPT
ChatGPT:
Please obtain the sessions mentioned here from an authorized session on chat.openai.com. The sessions can be used to
send POST requests to the /chatgpt endpoint along with a message in a JSON payload. It is important that the session_id,
which is your Authorization
header session, is included in the request. (Screenshot)
- Login to chat.openai.com
- at least ask any question.
- Open
Developer Tools
(Press F12) - Go to
Network Tab
- Select an ajax request (like step 4 in picture)
- Copy the content of
Authorization
- Set in Config.conf file.
(NOTE: This guide is still in progress.)
Before using the APIs, sign up for free accounts to get access credentials if you don't already have them:
- ChatGPT: https://openai.com/api/
- Google Bard: https://bard.google.com/
- Claude: https://claude.ai/chat/
Then, add your token(s) to the Config.conf
file. (see Configuration section).
git clone https://github.com/Amm1rr/Free-Chatbot-API.git && cd Free-Chatbot-API
python -m .venv venv
source .venv/bin/activate
pip install -r requirements.txt
Navigate into the src
directory, and run the web server using one of the methods below:
uvicorn main:app --reload --port 8000
-- OR --
python main.py
-- OR --
./Run-Server.sh
Available Endpoints:
---------- Google Bard
http://128.0.0.1:8000/bard
---------- Claude
http://128.0.0.1:8000/claude
---------- ChatGPT
http://128.0.0.1:8000/chatgpt
Input / Output
Input:
_____
{
"session_id": "your-session-id",
"message": "Hi, Who are you?",
"stream": True
}
--------------------
--------------------
Output:
_____
{
I'm a Chatbot assistant :)
}
try Claude with cURL
Once you have launched the webserver using uvicorn main:app --reload --port 8000
, run this cURL command in a terminal window:
curl -X 'POST' \
'http://localhost:8000/claude' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"message": "who are you?",
"session_id": "",
"stream": true
}'
Note: The session_id
is configured in the Config.conf file. If you send this variable empty, it will use the Config.conf
- Free-Chatbot-API\src\Config.conf
# Case-Sensative
[Claude]
COOKIE=[YOURS]
[ChatGPT]
ACCESS_TOKEN=[YOURS]
[Bard]
SESSION_ID=[YOURS]
(NOTE: This guide is still in progress.)
Google Bard API | Claude API | revChatGPT
This project is licensed under the MIT License. Feel free to use it however you like.