Settings

Theme

Show HN: An easy-to-use CLI tool for interfacing with OpenAI's models

github.com

1 points by mehmet_mhy 2 years ago · 1 comment · 1 min read

Reader

Hey again everyone,

Since I debuted Cha, a lot has changed, so I wanted to make a new post about it. Cha is a simple and open-source CLI chat tool designed to easily interface with OpenAI's text and image generation models through their API. I built this tool about 1.5 months ago and use it on a daily basis, to the point where I use it more than I use the ChatGPT website.

Currently, Cha supports the following features:

- Basic CLI chat interface to OpenAI’s LLM models.

- Web scraping for a provided link (supports JavaScript scraping).

- YouTube scraping; scraping the transcript from a video.

- Multi-line support; easily copy and paste new lines into the CLI.

- Generate images using OpenAI's image models.

- Supports interactive and non-interactive mode for chatting.

I think Cha is very useful, especially for command-line-based tasks, so I wanted to share it. Cha is still very young, so any feedback would be greatly appreciated.

Demo: https://www.youtube.com/watch?v=YcfFC1IU_SA

Code: https://github.com/MehmetMHY/cha

mehmet_mhyOP 2 years ago

To make Cha more seamless, I created the following command in my .zshrc:

chatgpt () { DEFAULT_MODEL="gpt-4-turbo-preview"

    # path to your OpenAI API key
    source /Users/mehmet/.custom/.env

    if [[ "$1" == "-f" && -n "$2" ]]; then
        cha -m $DEFAULT_MODEL -f "$2"
    elif [ $# -eq 0 ]; then
        cha --model $DEFAULT_MODEL
    else
        cha -m $DEFAULT_MODEL -s "$1"
    fi

    unset OPENAI_API_KEY
}

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection