Just simplifed the original script, and make it can remember our conversation. original repo 0xacx / chatGPT-shell-cli.
- Download
chatgpt_m.sh
- $export OPENAI_KEY=your_key_here
- If you are using iTerm and want to view images in terminal, install imgcat
- ./chatgpt_m.sh
- set alias 'chatgpt' for './chatgpt_m.sh'
# init
$ chatgpt
$ chatgpt -f <your file>
# Interactive input start
mass of sun
image: cat
history
models / model:
command: convert .avi to .mp4
# one liner
$ echo "How to view running processes on Ubuntu?" | chatgpt
$ chatgpt -p "What is the regex to match an email address?"
- -i, you can customize initial chat prompt to use in chat context mode.
- -f / -ip, You can also set an initial chat prompt from a file with
--init-prompt-from-file
i.e.chatgpt --init-prompt-from-file myprompt.txt
- Interactive commands:
image:
To generate images, start a prompt withimage:
If you are using iTerm, you can view the image directly in the terminal. Otherwise the script will ask to open the image in your browser.history
To view your chat history, typehistory
models
To get a list of the models available at OpenAI API, typemodels
model:
To view all the information on a specific model, start a prompt withmodel:
and the modelid
as it appears in the list of models. For example:model:text-babbage:001
will get you all the fields fortext-babbage:001
modelcommand:
To get a command with the specified functionality and run it, just typecommand:
and explain what you want to achieve. The script will always ask you if you want to execute the command. i.e.command: show me all files in this directory that have more than 150 lines of code
If a command modifies your file system or dowloads external files the script will show a warning before executing.
- If you have access to the GPT4 model you can use it by setting the model to
gpt-4
, i.e.chatgpt --model gpt-4
- To set request parameters you can start the script like this:
chatgpt --temperature 0.9 --model text-babbage:001 --max-tokens 100 --size 1024x1024
The available parameters are:- temperature,
-t
or--temperature
- model,
-m
or--model
- max number of tokens,
--max-tokens
- image size,
-s
or--size
(The sizes that are accepted by the OpenAI API are 256x256, 512x512, 1024x1024) - one line prompt,
-p
or--prompt
- one line prompt from a file in your file system,
-pf or --prompt-from-file
- temperature,
- TEMPERATURE = 0.5
- MAX_TOKENS = 1024
- SIZE = 512x512
- CONTEXT = true