cligpt
is a command-line interface for interacting
with the ChatGPT
API from OpenAI
.
With cligpt
,
you can quickly and easily generate text by sending prompts to ChatGPT
from your terminal.
Simply provide your OpenAI
API key and the message you want to generate,
and cligpt
will handle the rest.
cligpt
is written in Rust and uses the
clap
and
async-openai
crates
to provide a user-friendly interface for the ChatGPT
API.
It's perfect for developers who want
to quickly prototype text generation applications
or for anyone who wants to experiment with the power of the ChatGPT
API
from the comfort of their terminal.
Before installing cligpt
,
you need to make sure you have
Rust (version 1.65.0 or later)
and Cargo,
the package manager for Rust,
installed.
From crates.io (recommended)
Once you have Rust and Cargo installed,
you can install cligpt
from crates.io using Cargo:
cargo install cligpt
This will download the necessary dependencies,
compile the cligpt
binary,
and install it in your system.
Once the installation is complete,
you can run cligpt
by typing cligpt
in your terminal.
Directly from GitHub
Alternatively,
you can install cligpt
directly from the GitHub repository
using Cargo by running:
cargo install --git=https://github.com/schneiderfelipe/cligpt.git
You can also build cligpt
from source by cloning the GitHub repository
and running cargo build
:
git clone https://github.com/schneiderfelipe/cligpt.git
cd cligpt
cargo build --release
After building,
the binary will be located at target/release/cligpt
.
Alternatively,
you can install the binary directly instead of just building it.
Just run cargo install --path=.
instead of cargo build --release
.
To use cligpt
,
you need to provide your
OpenAI
API key
and the message you want to generate.
You can provide the API key using the -k
or --api-key
option,
or by setting the OPENAI_API_KEY
environment variable.
Here's an example usage:
cligpt --api-key YOUR_API_KEY 'Hello, ChatGPT!'
This will send the message 'Hello, ChatGPT!'
to the ChatGPT
API using
your API key and print the generated text to your terminal.
You can also specify additional options to customize the text generation, such as temperature, and the language model to use.
For example, you can set the temperature to 0.9 and use GPT-4:
cligpt --temperature 0.9 --model gpt4 'Hello, ChatGPT!'
In the example above, the API key will be read from the environment.
For more information on available options,
run cligpt --help
.
Contributions to cligpt
are welcome!
If you find a bug,
have a feature request,
or want to contribute code,
please open an issue
or a pull request
on the GitHub repository.
cligpt
is released under the MIT License.