Skip to main content

pipe-pai is a simple command-line tool that allows you to interact with OpenAI models through Unix pipes

Project description

pipe-pai

pipe-pai is a simple command-line tool that allows you to interact with OpenAI models through Unix pipes. Use it like this: ... | pai - hence the name "pipe-pie".

Installation

Install via pipx (recommended):

pipx install pipe-pai-tool

Or with pip:

pip install pipe-pai-tool

Or locally:

git clone git@github.com:krzysztofarendt/pai.git
cd pai
pipx install .

Ensure your OpenAI API key is set in the environment:

export OPENAI_API_KEY="your_api_key_here"

Optionally, set a default model using the PAI_MODEL environment variable:

export PAI_MODEL="gpt-4"

Usage

Pipe a prompt to pai and receive the model's response on stdout:

echo "Write a haiku about the sea" | pai

Alternatively, specify a different model or API key:

echo "Tell me a joke" | pai --model gpt-4 --api-key $OPENAI_API_KEY

Chat mode

By default, pai runs in the pipe mode with no chat history. You can enter an interactive multi-turn chat by:

pai --chat
> Write a poem about the moon

--------------------
<AI response displayed here>

To exit chat mode, send an empty prompt press ctrl+c or type q, exit, or quit.

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

pipe_pai_tool-0.1.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pipe_pai_tool-0.1.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file pipe_pai_tool-0.1.3.tar.gz.

File metadata

  • Download URL: pipe_pai_tool-0.1.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for pipe_pai_tool-0.1.3.tar.gz
Algorithm Hash digest
SHA256 73fb8cb861e68f32e2b9055d0e3d4bee911f3de99e75e5b5b98b0eba50aeece8
MD5 a5fadbf542bfb6cdc91d5cee9ac9ba3f
BLAKE2b-256 60ddc9627d8cfd45508621cc541dd478e2ea6946c51242f2a955c94715a2484f

See more details on using hashes here.

File details

Details for the file pipe_pai_tool-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pipe_pai_tool-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3445b64c9c7a952589c56218683c264ee6c3bf3cc5d8a3a2dfb469cef1956253
MD5 40643529cd7ed35503b36e8c53474714
BLAKE2b-256 85c7f966c4ad7c3bef2195f626aed97d94a4ea05bc490edd1e75cd0ab9063cfa

See more details on using hashes here.

Supported by

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