Skip to main content

Chat with LLMs from the terminal

Project description

Terminal LLM Chatbot

A python terminal-based chatbot application that integrates with language models. Features include multiline text input, streaming responses and many commands to

The idea came from

Features

  • Supports Claude 3.7 (with optional extended thinking), ChatGPT-4o and o3-mini
  • Terminal-based user interface with rich text formatting and code highlighting
  • Support for multiline text input
  • Streaming responses from the language model
  • Conversations are saved as text files for portability and easy manipulation
  • Anonymous chats that don't get saved anywhere
  • You can edit the conversation at any point to add/remove context or edit the system prompt
  • Change active model/conversation on the fly
  • Embed files from the filesystem or webpage content by url in your prompts
  • Quick temporary prompts that don't pollute the current conversation context
  • Configurable via a YAML config file

Installation

You can install llm_chat_term using uv by running:

uv tool install llm_chat_term

or if you don't have uv installed:

pip install llm_chat_term
# or
pipx install llm_chat_term

Set up your API key(s)

On first run, a config.yaml with default options is created in your Config dir (e.g. ~/.config/llm_chat_term) Edit it to add your API key(s) and customize other options. Then re-run the application.

Alternatively the application can read your API keys from your env (ANTHROPIC_API_KEY, OPENAI_API_KEY)

Usage

Run the chatbot from the command line:

llm_chat_term

Controls

  • Type your message and press Alt(Esc)+Enter to send
  • Use Enter to add a new line in your message
  • Type :exit or press Ctrl+D to exit the application
  • Type :help to view help for available commands
  • Press Ctrl+C to interrupt and exit

Commands

  • :help Displays help about the commands.
  • :info Displays info about this chat.
  • :edit, :e Opens the conversation history in $EDITOR (vim by default). Edit it and save and it will be reloaded in the message history. You can edit the system prompt for the current conversation this way.
  • :chat Display a menu to select a different chat.
  • :model Display a menu to select a different chat.
  • :redraw Redraw the whole conversation.
  • :tmp {prompt} This prompt won't be saved to the conversation history. Ideal for quick one-off questions in the middle of a large conversation
  • :think {prompt} Enable thinking mode only for this question (Claude only).
  • :read {path} Embed a text file in the prompt (replaces the line with :read).
  • :web {url} Embed a webpage contents in the prompt (replaces the line with :web).
  • :exit Exits the application. The conversation is saved if not anonymous chat.

Configuration

This is the initial config.yaml file:

llm:
  models:
    - provider: anthropic
      name: claude-3-7-sonnet-20250219
      temperature: null
    - provider: openai
      name: o3-mini
      temperature: null
    - provider: openai
      name: gpt-4o
      temperature: null
  api_keys:
    - provider: anthropic
      api_key: ""
    - provider: openai
      api_key: ""
  system_prompt:
    "You are a helpful assistant responding to a user's questions in
    a PC terminal application.

    The user is an experienced software engineer, your answers should be concise and
    not repetitive.

    Skip conclusions and summarizations of your answers.

    If the user asks for a change in code, don't return the whole code, just the
    changed segment(s).

    Return your answers in markdown format, and wrap code in ``` blocks.
    "
ui:
  prompt_symbol: ">>> "
  user: user
  assistant: assistant
colors:
  user: cyan
  assistant: grey39
  system: yellow

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

llm_chat_term-0.2.0.tar.gz (57.9 kB view details)

Uploaded Source

Built Distribution

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

llm_chat_term-0.2.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file llm_chat_term-0.2.0.tar.gz.

File metadata

  • Download URL: llm_chat_term-0.2.0.tar.gz
  • Upload date:
  • Size: 57.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llm_chat_term-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c46ef41d737314bc018fb3f37ebd96abac954c2df3c963131d6c219865ef7354
MD5 3b8df25f4ef5988d94863329ad3f92cd
BLAKE2b-256 ef4a80dc621ce34db54ca9f950731a09621a5fa5311acdd37a60253294a59a2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_chat_term-0.2.0.tar.gz:

Publisher: main.yml on vtsiolkas/llm_chat_term

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_chat_term-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: llm_chat_term-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llm_chat_term-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7249c309d9b5533c2b6a41ff1acc6dd566b0c5942d1265a229cadf47e1293917
MD5 0d25e5b9713ccf58a15888b53b67d73b
BLAKE2b-256 6459ca992cc84b82476dbc5439a6a1bf0b96f0fe2cd04ec1898369b2a952a663

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_chat_term-0.2.0-py3-none-any.whl:

Publisher: main.yml on vtsiolkas/llm_chat_term

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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