Skip to main content

Interact with the OpenAI ChatGPT API (and other text generators)

Project description

<!– SPDX-FileCopyrightText: 2021 Jeff Epler

SPDX-License-Identifier: MIT –> # chap - A Python interface to chatgpt, including a terminal user interface (tui)

![Chap screencast](https://github.com/jepler/chap/blob/main/chap.gif)

## installation

Install with e.g., pipx install .

## configuration

Put your OpenAI API key in the platform configuration directory for chap, e.g., on linux/unix systems at ~/.config/chap/openai_api_key

## commandline usage

  • chap ask “What advice would you give a 20th century human visiting the 21st century for the first time?”

  • chap render –last

## interactive terminal usage
  • chap tui

## Sessions & Commandline Parameters

Details of session handling & commandline arguments are in flux.

By default, a new session is created. It is saved to the user’s state directory (e.g., ~/.local/state/chap on linux/unix systems).

You can specify the session filename for a new session with -n or to re-open an existing session with -s. Or, you can continue the last session with –last.

You can set the “system message” with the -S flag.

You can select the text generating backend with the -b flag:
  • openai_chatgpt: the default, paid API, best quality results

  • textgen: Works with https://github.com/oobabooga/text-generation-webui and can run locally with various models, basic and low quality. Needs the server URL in $configuration_directory/textgen_url.

  • lorem: local non-AI lorem generator for testing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chap-0.1.0.tar.gz (335.4 kB view hashes)

Uploaded Source

Built Distribution

chap-0.1.0-py3-none-any.whl (12.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page