Awesome
OpenAI API Quickstart with FastAPI
This is an example pet name generator app used in the OpenAI API quickstart tutorial. It uses the FastAPI web framework. Check out the tutorial or follow the instructions below to get set up.
Setup
-
If you don’t have Python installed, install it from here
-
Clone this repository
-
Navigate into the project directory
$ cd openai-quickstart-fastapi
-
Create a new virtual environment
# Linux $ python -m venv venv $ . venv/bin/activate
# Windows python -m venv venv venv\Scripts\activate
-
Install the requirements
$ pip install -r requirements.txt
-
Make a copy of the example environment variables file
# Linux $ cp .env.example .env
# Windows xcopy .env.example .env
-
Add your API key to the newly created
.env
file -
Run the app
$ python app.py
You should now be able to access the app at http://localhost:5001!
This repogitory is based on the Flask code at openai-quickstart-python. For the full context behind OpenAI API Quickstart(Flask), check out the tutorial.