Skip to main content

A CLI tool for prompting an LLM

Project description

cli_lm

Switch context less by using a really cheap LLM at the command line.

Installation

# Install from source
git clone https://github.com/davenpi/cli_lm.git
cd cli_lm
pip install -e .

# Install from PyPI
pip install cli-lm

Quick Start

The first run will prompt for your Open AI API key. Just paste the key in. Or create the key directly in ~/.cli_lm/.env with

echo "OPENAI_API_KEY=your_new_key" > ~/.cli_lm/.env

Note you'll have to pay Open AI to get an API key and start using their models. For now this package sets gpt-4o-mini as the model of choice. It costs 0.15¢/0.60¢ per 1 million input/output tokens. 1 token ~ 1 word.

# Directly ask a question
clm "How do I amend a commit in git?"

# Interactive mode (input in python interpreter)
clm
> How do I list the processes listening on a given port?

Chat is assumed to be multiturn (i.e., you'll always be asked for your next prompt). Just hit Ctrl+c or Ctrl+d to exit.

Configuration

The package looks for your Open AI API key in ~/.cli_lm/.env.

To quickly update your API key run:

echo "OPENAI_API_KEY=your_new_key" > ~/.cli_lm/.env

It works on a Mac, but it hasn't been tested on another system.

Ongoing Improvements

  • Multi turn chat capability
  • Improved multiline input
  • Would be nice to arrow backward on input
  • System prompting for really concise, helpful answers
  • Make set up easier
  • Add token/cost accounting
  • Make it faster (imports can be slow)
  • Add color

License

MIT

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

cli_lm-0.1.5.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

cli_lm-0.1.5-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file cli_lm-0.1.5.tar.gz.

File metadata

  • Download URL: cli_lm-0.1.5.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for cli_lm-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8fc9f43fcd9e202b26a3d31bd8523679884d4a2ed7fd82c81449e81081604d83
MD5 cda7d9497b85fc3e0ca272872fb1b074
BLAKE2b-256 23290e91ec4a61947ea8530d80cb5980cce9061808f236e7974c25c553683529

See more details on using hashes here.

File details

Details for the file cli_lm-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: cli_lm-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for cli_lm-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cbfc91181343887e232f9eb6719714a7e214ef90c5dcfed4b45c31e70d030632
MD5 3bc08fda174453ed3b3fdcb558735826
BLAKE2b-256 86c300ef8963e5db706f9c046148639cac2c0ab5454b3b188a3ad885846b0d31

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