💥 CLI for OpenAI's ChatGPT.
Resuming chat sessions from a previous point.
brew tap shuntaka9576/tap
brew install shuntaka9576/tap/oax
Command-line text editor tools (Vim/Neovim/Nano, etc.).
Open profile (~/.config/oax/profiles.toml
).
oax config --profiles
Specify the OpenAI API API key in the apiKey field (replace sk-xxxx
).
[[profiles]]
name = "personal"
apiKey = "sk-xxxx" # <--
default = true
Open setting (~/.config/oax/settings.toml
).
oax config --settings
Specify edit to lunch editor. vim
or nvim
.
[setting]
editor = "vim" # <--
Start ChatGPT. Default model gpt-3.5-turbo
. Open ChatGPT request file (~/.config/oax/chat-log/2006-01-02_15-04-05.toml
).
oax chat
Specify sent content to ChatGPT. exit with wq.
[[messages]]
role = "user"
content = '''
# Remove this comment and specify content to send to OpenAI API; otherwise, nothing is sent.
'''
Streaming response is returned from ChatGPT.
$ oax chat
Hello! How can I assist you today?
continue (y/n)?: n
saved: ~/.config/oax/chat-log/2023-03-26_17-01-54.toml
When resuming, you can perform fuzzy search on chat history files by their titles.
oax chat -c
Files can be resumed from the middle of the process by specifying the full path of the file.
oax chat -m "gpt-3.5-turbo" -f "~/.config/oax/chat-log/2023-03-26_15-11-04.toml"
File Path | Description | Open Command |
---|---|---|
~/.config/oax/settings.toml |
Specify command assist information for oax. | oax config --settings |
~/.config/oax/profiles.toml |
Specify information required for API connection. | oax config --profiles |
Option | Description | Required | Default |
---|---|---|---|
editor | Integrated editor | true | vim |
chatLogDir | Directory for saving chat logs | false | ~/.config/oax/chat-log |
e.g.
[setting]
editor = "nvim"
chatLogDir = "~/.config/oax/chat-log"
Option | Description | Required | Default |
---|---|---|---|
model | ChatGPT model | false | gpt-3.5-turbo |
fileNameFormat | Providing ${title} placeholder |
false | %Y-%m-%d_%H-%M-%S |
chat.templates | Chat template | false |
[chat]
model = "gpt-3.5-turbo"
fileNameFormat = "%Y-%m-%d_%H-%M-%S"
[[chat.templates]]
name = "friends"
[[chat.templates.messages]]
role = "system"
content = "You are ChatGPT, a large language model trained by OpenAI. You are a friendly assistant that can provide help, advice, and engage in casual conversations."
Specify a model.
oax chat -m "gpt-4"
Specify a chat template
oax chat -t "friends"
Option | Description | Required | Default |
---|---|---|---|
name | Profile name | true | vim |
apiKey | OpenAI API key | true | ~/.config/oax/chat-log |
default | Set the default profile configuration (API key) to be used. | false. Please ensure that the "default" option is set for at least one Profile. | true |
organizationId | OpenAI Organization ID | false |
e.g.
[[profiles]]
name = "me"
apiKey= "sk-xxxx"
default = true
[[profiles]]
name = "org"
organizationId = ""
rm -rf ~/.config/oax