Skip to content
/ heygpt Public
forked from fuyufjh/heygpt

A simple common-line interface for ChatGPT API.

License

Notifications You must be signed in to change notification settings

jtrv/heygpt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

heygpt

A simple common-line interface for ChatGPT API.

  • 🌟 Streaming output!
  • 💡 One-shot mode to get a quick answer
  • 🤖 Interactive mode to have a conversation

screenshot

Demo (YouTube)

Quickstart

Install latest release version to $HOME/.cargo/bin/ via cargo:

cargo install heygpt

You'll need a OpenAI API key (you can get one here), and you'll need to export your API Key as an environment variable:

You can also set a OpenAI API base environment variable, just like openai-python

export OPENAI_API_KEY=<your api key>
# export OPENAI_API_BASE="https://api.openai.com/v1"

Then you can start an interactive conversation with ChatGPT:

heygpt

OR use the one-shot mode by providing a prompt:

heygpt how to record screen on mac

You can also compose prompt with bash tricks like

heygpt read the code and tell me what it is doing: $(cat src/main.rs)
heygpt read the code diff and write a commit message: $(git diff)

You may need write prompt in multiple lines:

heygpt "please translate this poem to English:
> 床前明月光,
> 疑是地上霜。
> 举头望明月,
> 低头思故乡。"

Advanced

Commands in interactive mode

Enter \? to see available commands:

user => \?
Available commands:
  \?, \help: Show this help
  \b, \back: Retract and back to the last user message
  \h, \history: View current conversation history

About

A simple common-line interface for ChatGPT API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%