Skip to content

streamfan/GPT-TUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPT-TUI

A TUI to interact with ChatGPT!

This is a reactive application that runs entirely in your terminal. It will adjust to the window size dynamically as well as font size.

image

image

image

image

It uses Textual and Rich for formatting outputs.

Authentication

The OpenAI API uses API keys for authentication. Visit your API Keys page to retrieve the API key you'll use in your requests.

Remember that your API key is a secret! Do not share it with others or expose it in any client-side code (browsers, apps).

Production requests must be routed through your own backend server where your API key can be securely loaded from an environment variable or key management service.

All API requests should include your API key in an Authorization HTTP header as follows:

Authorization: Bearer YOUR_API_KEY

From here you'll need to place your auth token into the .env file.

If you're unsure about the formatting you can do:

cp .env.example .env

And then just replace with your key.

Development

Git HTTPS Clone:

git clone https://github.com/streamfan/GPT-TUI.git

Git SSH Clone:

git clone [email protected]:streamfan/GPT-TUI.git

Github CLI Clone:

gh repo clone streamfan/GPT-TUI

Dependencies

You can get away with just running poetry shell and poetry install.

From there you can simply run:

python main.py

Or if you prefer using the textual CLI you can do:

textual run main.py

Poetry

You'll need poetry

curl -sSL https://install.python-poetry.org | python3 -

Once installed you can then create a virtual environment and connect to the shell by doing:

poetry shell

And then install the dependencies by running:

poetry install

Docker

This TUI can be ran entirely in-container interactively, as well as over SSH.

See docs on how to install docker: https://docs.docker.com/get-docker/

Textual

You can install textual using poetry or by doing:

pip install "textual[dev]"