A simple terminal UI for GPT-4
Update README to reflect recent updates
Add Claude support, update history format, better summary prompt
Update deps, fix pasting, and "fix" long text issue


browse  log 



You can also use your local clone with git send-email.

#GPT-4 (and Claude 3) Client

A simple terminal UI for interacting with GPT-4 or Claude 3 via their respective API.


This is meant to be a replacement for the OpenAI web UI, because OpenAI uses the dark pattern of disabling conversation history if you ask them to not train AI on your private data, even if you're a paying (i.e. ChatGPT Plus) customer.

Since this CLI uses the GPT-4 API, it has the following benefits:

  • Pay-per-use - Even as a fairly heavy user (10-20 questions some days), I pay <$10/month in API charges.
  • No training on data - OpenAI doesn't use API queries to train their models


  • Record, search, and continue past conversation
  • Chat with with GPT-4 or Claude 3 by specifying --backend={gpt4,claude}
  • Markdown support in terminal via charmbracelet/glamour
  • Generates a title based on initial prompt (similar to web UI)
  • Streaming responses from API


#Key commands

To send a message, type Alt+Enter. To scroll through a conversation, use Tab to switch from the message pane, then j/k to scroll. Press Tab again to go back to the chat window.

F1 and F2 toggle to the conversation and history panes respectively.

#Running the TUI

# <backend> is either 'gpt4' or 'claude'
./gpt4-tui --api_key=$APIKEY --backend=<backend>

Personally, I have a wrapper script like:

cat `which gpt4`

if [ "$1" = "openai" ]; then
  gpt4-tui --api_key="$(pass show openai)" --backend=gpt4
  gpt4-tui --api_key="$(pass show claude)" --backend=claude

This defaults to Claude unless invoked with gpt4 openai


Conversation view:

Screenshot of the terminal UI, showing a question about joining strings in Starlark

History view:

Screenshot of the terminal UI, showing a list of past conversations


  • [ ] Figure out long term database/persistence structure
  • [ ] Make Ctrl+C and all behave reasonably even when streaming
  • [ ] Generally clean up code
    • [ ] Make main.go less of a monstrosity
  • [ ] Add support for 'Stop generating'
    • Useful when the LLM misunderstands your question
  • [x] Make title consistently not have quotes around it
    • This is just a matter of fixing the prompt most likely
  • [x] Figure out graphical glitches when scrolling long markdown blocks
    • Have hacked around this by just using less of the window