Skip to main content

A simple CLI to chat with OpenAI GPT Models

Project description


Chat with LLM models directly from the command line.


PyPI PyPI - Python Version GitHub License Ruff pre-commit semantic-release Gitmoji

Screen Recording

Check Out the Docs


pipx install llm-term


Then, you can chat with the model directly from the command line:


llm-term works with multiple LLM providers, but by default it uses OpenAI. Most providers require extra packages to be installed, so make sure you read the Providers section below. To use a different provider, you can set the --provider / -p flag:

llm-term --provider anthropic

If needed, make sure you have your LLM's API key set as an environment variable (this can also set via the --api-key / -k flag in the CLI). If your LLM uses a particular environment variable for its API key, such as OPENAI_API_KEY, that will be detected automatically.

export LLM_API_KEY="xxxxxxxxxxxxxx"

Optionally, you can set a custom model. llm-term defaults to gpt-3.5-turbo (this can also set via the --model / -m flag in the CLI):

export LLM_MODEL="gpt-4"

Want to start the conversion directly from the command line? No problem, just pass your prompt to llm-term:

llm-term show me python code to detect a palindrome

You can also set a custom system prompt. llm-term defaults to a reasonable prompt for chatting with the model, but you can set your own prompt (this can also set via the --system / -s flag in the CLI):

export LLM_SYSTEM_MESSAGE="You are a helpful assistant who talks like a pirate."



By default, llm-term uses OpenAI as your LLM provider. The default model is gpt-3.5-turbo and you can also use the OPENAI_API_KEY environment variable to set your API key.


You can request access to Anthropic here. The default model is claude-2.1, and you can use the ANTHROPIC_API_KEY environment variable. To use anthropic as your provider you must install the anthropic extra.

pipx install "llm-term[anthropic]"
llm-term --provider anthropic


You can request access to the MistralAI here. The default model is mistral-small, and you can use the MISTRAL_API_KEY environment variable.

pipx install "llm-term[mistralai]"
llm-term --provider mistralai


GPT4All is a an open source LLM provider. These models run locally on your machine, so you don't need to worry about API keys or rate limits. The default model is mistral-7b-openorca.Q4_0.gguf, and you can see what models are available on the GPT4All Website. Models are downloaded automatically when you first use them. To use GPT4All as your provider you must install the gpt4all extra.

pipx install "llm-term[gpt4all]"
llm-term --provider gpt4all --model mistral-7b-openorca.Q4_0.gguf

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

llm_term-0.13.0.tar.gz (151.1 kB view hashes)

Uploaded Source

Built Distribution

llm_term-0.13.0-py3-none-any.whl (8.9 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