Skip to content

llm CLI tool

llm prompt "how to restart prometheus as I have updated the config file that is shared to the container: $(<docker-compose.yml)"

Installation

# Install
pipx install llm
llm install llm-cmd llm-claude-3 llm-ollama

Usage

Set model

Natural Language Commands

 llm cmd "delete all files returned by this command, 
  respecting that some have spaces in filenames and it's linux: fd Leopold"
> fd Leopold -X rm -f {}

Chat

# Chat with history
llm chat --model claude-3.5-sonnet --history previous_chat.json "your message"

List models

$ llm models
OpenAI Chat: gpt-4-turbo (aliases: gpt-4-turbo-preview, 4-turbo, 4t)
OpenAI Chat: gpt-4o (aliases: 4o)
OpenAI Chat: gpt-4o-mini (aliases: 4o-mini)
OpenAI Chat: o1-preview
OpenAI Chat: o1-mini
OpenAI Completion: gpt-3.5-turbo-instruct (aliases: 3.5-instruct, chatgpt-instruct)
Anthropic Messages: claude-3-opus-20240229 (aliases: claude-3-opus)
Anthropic Messages: claude-3-sonnet-20240229 (aliases: claude-3-sonnet)
Anthropic Messages: claude-3-haiku-20240307 (aliases: claude-3-haiku)
Anthropic Messages: claude-3-5-sonnet-20240620 (aliases: claude-3.5-sonnet)
Ollama: llama3.2:latest (aliases: llama3.2)
Ollama: llama3.1:70b

Run a Command

llm cmd list files in /tmp
> ls /tmp

Embed

llm embed -m 3-small -c "Hello there"