Skip to main content

cli-chat

cli-chat is a command-line tool that allows you to have a conversation with ChatGPT from your terminal.

Documentation

The documentation for cli-chat can be found here.

Installation

Mac

cli-chat can be installed on Mac using Homebrew. To install cli-chat using Homebrew, simply execute the following command in your terminal:

brew tap tefx/tap
brew install cli-chat

Other Platforms

To install cli-chat, execute the following command in your terminal:

pip install cli-chat

Alternatively, you can clone the repository and install the dependencies using poetry. Here are the steps to follow:

  1. Install poetry.
  2. Clone the repository.
  3. Navigate to the repository's root directory.
  4. Execute poetry install.

Usage

To start a conversation with ChatGPT, execute the following command in your terminal:

cli-chat

Or, you can start the script in poetry's virtual environment:

poetry run cli-chat

Here are a few things to keep in mind when using cli-chat:

  • Before being able to use the tool, you must obtain an API key by registering for it here.
  • To end the conversation, type thanks, thx, tq, or a similar phrase.
  • You can navigate through your conversation history with the arrow keys.
  • Common key-bindings and auto-suggestions are supported, thanks to prompt_toolkit.

Control Commands

You can use special control commands to modify cli-chat's behavior. These commands should be placed at the beginning of your question string and should start with a backslash.

The supported control commands are listed below:

Command Arguments Tags Description
\no-render Prevent the answer from being rendered in markdown.
\load-file Load a file and use the contents as the remaining part of your question.
\long Accept multi-line inputs from now on. Use Meta+Enter or ESC followed by Enter to finish.
\save append Save the last answer to a file.
\hide-answer Do not show the answer. WARNING: Always check the answer first toavoid losing it if you want to save it later.
\continue idx Resume the conversation from a previous answer. idx should be a negative number as shown by the \history command.
\forget Delete your conversation history.
\history Show your entire conversation history.

You can combine multiple control commands by separating them with |. For instance, \no-render|load-file will load a file and prevent the answer from being rendered in markdown.

For some commands, additional arguments and tags may be specified by using the syntax command(arg1, arg2, ...){tag1, tag2, ..}. For example, \save{append} will append the answer to the file instead of overwriting it, while \continue(-1) will resume the conversation from the answer with index -1 in the history.

Example

Here are a few examples of what a conversation with cli-chat might look like:

  1. Show answer in markdown Example 1 Example 2

  2. Multi-line input Example 5

  3. Not rendering the answer in markdown, loading a file, and saving the answer to a file Example 3

  4. Check answer history and continue from a previous answer Example 4

Configuration

Use cli-chat-config to manage key and input history.

TODO

  • Add autocomplete for control commands.
  • Add support for searching and using prompts from the Awesome ChatGPT Prompts

Metadata

Release files for cli-chat 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cli-chat 0.2.3
File Size Uploaded
cli_chat-0.2.3.tar.gz 17.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cli-chat 0.2.3
File Interpreter ABI Platform
cli_chat-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 37.2 kB

Release files / cli_chat-0.2.3.tar.gz

Download URL cli_chat-0.2.3.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
504bd934f90f108aa27131f0dd0c2615e39b376be3b1e9f230624a7ce4246b99
BLAKE2b-256 checksum
How to use checksums
d8591b2316d65a909dc8a95503679799e4b96c734e35a828ed05bed31c2bef5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.11.2 Darwin/22.2.0

Release files / cli_chat-0.2.3-py3-none-any.whl

Download URL cli_chat-0.2.3-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44b6df0149e2a3fb24175c29207e69fc4134382021aaa8007ecd3637afc90612
BLAKE2b-256 checksum
How to use checksums
ff7b16b0a397c6e870cf3ca8a1106413079302b9d6b7acd96f1c7a0e4145787e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.11.2 Darwin/22.2.0

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page