Skip to content

A RESTful web service created to provide a simple API for generating text using various GPT models based on different providers.

License

Notifications You must be signed in to change notification settings

nagarajpandith/GPTGateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPT Flask API

A RESTful web service created using the xtekky/gpt4free library.

# 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

Create a .flaskenv file and fill the API_KEY var.

python3 index.py

Local Usage

  1. Using curl
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
  1. Using Any API testing platform like Postman, Thunder client etc.
{
  "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. For the API key, email me at [email protected].

Releases

No releases published

Packages

No packages published