Take chatGPT into command line.
- clone this repo
- pip3 install -U -r requirements.txt
- get your apikey from https://platform.openai.com/account/api-keys and put it in
.key
$ ./gptcli.py -h
usage: gptcli.py [-h] [-r] [-k KEY] [-p PROXY]
options:
-h, --help show this help message and exit
-n query openai in non-stream mode (default: False)
-r attach server response in request prompt, consume more tokens to get better results (default: False)
-k KEY path to api_key (default: .key)
-p PROXY http/https proxy to use (default: None)
Console help (with tab-complete):
$ ./gptcli.py
Input: -h
usage: Input [-help] [-reset] [-exit] [-multiline]
options:
-help show this help message
-reset reset session, i.e. clear chat history
-exit exit console
-multiline input multiple lines, end with ctrl-d(Linux/macOS) or ctrl-z(Windows). cancel with ctrl-c
Run in Docker:
# build
$ docker build -t gptcli:latest .
# run
$ docker run -it --rm -v $PWD/.key:/gptcli/.key gptcli:latest -h
# for host proxy access:
$ docker run --rm -it -v $PWD/.key:/gptcli/.key --network host gptcli:latest -rp socks5://127.0.0.1:1080
- Session based
- Markdown support
- Syntax highlight
- Proxy support
- Multiline input
- Stream output