-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f774366
commit 01df7e9
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
# GPT Flask API | ||
|
||
A RESTful web service created using the [xtekky/gpt4free](https://github.com/xtekky/gpt4free) library. | ||
|
||
```bash | ||
# Clone the repository | ||
git clone https://github.com/nagarajpandith/gpt-flask.git | ||
|
||
# Navigate to the project directory | ||
cd gpt-flask | ||
|
||
# Create a virtual environment | ||
python3 -m venv venv | ||
|
||
# Activate the virtual environment | ||
source venv/bin/activate | ||
|
||
# Install the required packages | ||
pip3 install -r requirements.txt | ||
``` | ||
|
||
|
@@ -13,3 +24,27 @@ Create a .flaskenv file and fill the API_KEY var. | |
```bash | ||
python3 index.py | ||
``` | ||
|
||
## Local Usage | ||
|
||
1. Using `curl` | ||
|
||
```bash | ||
curl -X POST -H "Content-Type: application/json" -d '{"content": "YOUR_PROMPT", "provider": "PROVIDER_NAME", "api_key":"API_KEY_HERE"}' http:https://127.0.0.1:5000/chat_completion | ||
``` | ||
|
||
2. Using Any API testing platform like Postman, Thunder client etc. | ||
|
||
- Endpoint: http:https://127.0.0.1:5000/chat_completion | ||
- Body Example: | ||
|
||
```json | ||
{ | ||
"content": "YOUR_PROMPT", | ||
"provider": "PROVIDER_NAME", | ||
"api_key": "API_KEY_HERE" | ||
} | ||
``` | ||
|
||
> **Note** | ||
> If you want to use the Hosted API, it's live at [https://gpt-flask.onrender.com](https://gpt-flask.onrender.com/). For the API key, email me at [[email protected]](mailto:[email protected]). |