Skip to content

quietlyecho/simple-chatgpt-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instruction

This is a simple CLI program to use ChatGPT.

Prerequisites

  1. Have an OpenAI API key. Refer to OpenAI website for more info.
  2. Add balance in your account.
  3. Store your API key to a safe place, for example, ~/.api_key_openai_1.
  4. Add below line in your ~/.zshrc or ~/.bashrc (or other shell's equivalent).
export OPENAI_API_KEY="$(cat $HOME/.api_key_openai_1 2>/dev/null || echo '')"
  1. Remember to source the API key: source ~/.zshrc or source ~/.bashrc

Usage

Do below if you use the program for the first time.

  1. git clone this repo to your computer, then cd into your local repo.
  2. Create a Python virtual environment for this repo, activate it, and do pip install -r requirements.txt
  3. Make file call_chatgpt_api.py executable: chmod u+x call_chatgpt_api.py
  4. Start the program by: ./call_chatgpt_api.py; you can change model by adding -m argument, like: ./call_chatgpt_api.py -m "gpt-4.1"; available model names are on OpenAI website.
  5. Type exit or quit in your prompt turn to stop the program.

About

A simple CLI to use ChatGPT with its Python API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages