A tool for chatting using the ChatGPT API, written in Rust CLI.

Overview

ChatGPT CLI

  • A tool for chatting using the ChatGPT API, written in Rust CLI.
  • You can use this tool to chat, just by setting your API Key.
  • You can modify the API domain and other API parameters when you start the chat.
  • If you like this tool, please join me to complete the TODO list, and let's improve this tool together

QuickStart

Usage

  • Linux/MacOS Run the following command in your terminal:

    chatgpt_rust
    

  • Use prompt: chatgpt_rust -p "xxxx"

  • Use Ctrl+c cancel the gpt request

cargo Install

  • If you have Rust installed, you can install the CLI using cargo:
cargo install chatgpt_rust

Install from source code

  1. build code
cargo build
  1. cd target/debug
   ./chatgpt_rust

User Guide

  • chatgpt_rust --help
                    ChatGPT CLI Create by zhulg ([email protected])
            | 1.You just need to input your api key, the cli version V0.2.0     |
            | 2.You can modify the API domain and other API parameters          |
            | 3.If you want to use it in China, you can use my api key          |
            |-------------------------------------------------------------------|

Usage: chatgpt_rust [OPTIONS]

Options:
  -d, --Domain <DomainName>        Sets the API Domain name. [default: api.openai.com]
  -k, --key <APIKey>               Sets the API key. If not provided, the cli will ask for it,
                                   You can also set the OPENAI_API_KEY environment variable. [default: ]
  -p, --prompt <prompt>            Sets the prompt for this session. [default: ]
  -m, --model <model>              Sets the GPT model to use. gpt-3.5-turbo or gpt-3.5-turbo-0301 [default: gpt-3.5-turbo]
  -t, --temperature <temperature>  Sets the temperature for text generation. [default: 0.5]
  -l, --length <max_tokens>        sets the max_tokens, default is 1000 [default: 1000]
  -h, --help                       Print help
  -V, --version                    Print version

Longer explanation to appear after the options when displaying the help information from --help or -h

Option:

Set your ‘OPENAI_API_KEY’ Environment Variable using zsh, No set will ask the user to input the API key in the terminal.

  1. Run the following command in your terminal, replacing yourkey with your API key.
echo "export OPENAI_API_KEY='yourkey'" >> ~/.zshrc

  1. Update the shell with the new variable:
source ~/.zshrc
  1. Confirm that you have set your environment variable using the following command.
echo $OPENAI_API_KEY

The value of your API key will be the resulting output.

TODO:

  • Support save message to file
  • import chat message from file
  • Support read prompt from file
You might also like...
a command-line tool that transforms a Git repository into a minimal format for ChatGPT queries
a command-line tool that transforms a Git repository into a minimal format for ChatGPT queries

gprepo /dʒiːpiːˈɹi:pi:oʊ/ a command-line tool that transforms a Git repository into a minimal format for ChatGPT queries. Features Excludes LICENSE an

A simple command-line tool for conversing with ChatGPT

daberu A simple command-line tool for conversing with ChatGPT. "daberu" is a Japanese translation of "chatting". $ daberu -h ChatGPT client tool that

Api testing tool made with rust to use for api developement (Kind of Tui)
Api testing tool made with rust to use for api developement (Kind of Tui)

Api testing tool made with rust to use for api developement (Kind of Tui) This Rust project provides a simple yet powerful tool for making HTTP reques

RustGPT is a ChatGPT UI built with Rust + HTMX: the power of Rust coupled with the simplicity of HTMX 💚

RustGPT 🦀✨ RustGPT.Blog.Post.mp4 Welcome to the RustGPT repository! Here, you'll find a web ChatGPT clone entirely crafted using Rust and HTMX, where

Mini Rust CLI to deploy sites to Netlify using their API

This is a Rust CLI that uses the Netlify API to deploy sites.

ChatGPT powered Rust proc macro that generates code at compile-time.

gpt-macro ChatGPT powered Rust proc macro that generates code at compile-time. Implemented Macros auto_impl!{} #[auto_test(...)] Usage Get ChatGPT API

ChatGPT-Code-Review is a Rust application that uses the OpenAI GPT-3.5 language model to review code

ChatGPT-Code-Review is a Rust application that uses the OpenAI GPT-3.5 language model to review code. It accepts a local path to a folder containing code, and generates a review for each file in the folder and its subdirectories.

A small CLI tool to query ArcGIS REST API services, implemented in Rust. The server response is returned as pretty JSON.

A small CLI tool to query ArcGIS REST API services, implemented in Rust. The server response is returned as pretty JSON.

chatgpt from the command line 🤖💬

Talk to ChatGPT from your terminal. Quickstart First you'll need to install the CLI: cargo install chatgpt-cli Then, you'll need to make sure your ca

Comments
  • Two suggestions for optimization proposal.

    Two suggestions for optimization proposal.

    1. Can it support streaming output, especially when the text is very long, so that we don't have to wait and can view partial content first?
    2. Support Ctrl-c to cancel the query. It is possible to discover that the input is incorrect or the output is not as expected, so it is important to end it as soon as possible and start over.
    opened by jiahut 1
Releases(v0.3.2)
Owner
null
Rust-based CLI library for OpenAI ChatGPT API

This is a Rust library that provides a CLI (command-line interface) for easy and convenient access to the OpenAI ChatGPT API. The library offers a simple and straightforward way to integrate the ChatGPT API into your Rust-based applications.

bigduu 10 Mar 9, 2023
Rust-powered CLI tool designed to simplify and streamline the release process with help of ChatGPT

$ releasecraftsman ????‍♂️?? Automate Your Release Process with Precision and Ease. ?? Features Generate well-crafted release notes using GPT-3.5 and

Tornike Gomareli 7 Sep 21, 2023
A CLI tool that uses ChatGPT to automatically generate commit messages.

Auto Git Commit This project is a tool that uses the OpenAI GPT model to automatically generate commit messages for Git commits based on the changes m

XIAO YU 16 Mar 5, 2024
A command-line interface for interacting with the ChatGPT API from OpenAI

cligpt cligpt is a command-line interface for interacting with the ChatGPT API from OpenAI. With cligpt, you can quickly and easily generate text by s

Felipe S. S. Schneider 6 Apr 4, 2023
A simple common-line interface for ChatGPT API.

heygpt A simple common-line interface for ChatGPT API. ?? Streaming output! ?? One-shot mode to get a quick answer ?? Interactive mode to have a conve

Eric Fu 88 Apr 17, 2023
ChatGPT CLI - A minimal assistant in the terminal

ChatGPT CLI A lightweight ChatGPT CLI - Chat completion. Interact with ChatGPT from your terminal and save the conversation in a text file. Get starte

Imad E. 5 Mar 14, 2023
Using ChatGPT/GPT-3.5/GPT-4 in the terminal.

AIChat Using ChatGPT/GPT-3.5/GPT-4 in the terminal. AIChat in chat mode: AIChat in command mode: Install With cargo cargo install --force aichat Bina

null 1.1k Apr 17, 2023
A CLI tool you can pipe code and then ask for changes, add documentation, etc, using the OpenAI API.

AiBro This is your own little coding bro, immersed in the world of AI, crypto, and all other types of over hyped tech trends. You can pipe it code and

Josh Bainbridge 5 Sep 5, 2023
This is a simple command-line interface tool that allows you to interact with ChatGPT from OpenAI or Azure.

HeyGPT This is a simple command-line interface tool that allows you to interact with ChatGPT from OpenAI or Azure. You can use it to: Chat with ChatGP

Philip 5 Mar 28, 2023
Koi is a simple tool built to let you use ChatGPT through the command line

Koi is a simple tool built to let you use ChatGPT through the command line. It adds the ability to let ChatGPT run commands on your computer in order to help you out, or to help you out with complicated tasks.

Shivam Sharma 9 Mar 28, 2023