Skip to content

m3at/zsh-llm-replace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zsh-llm-replace

Zsh plugin to integrate LLMs into the shell for quick command generation.

quick_demo.mp4

Demo with gpt-4.1-mini's priority tier

Supports Gemini (default with free credits) and OpenAI-compatible APIs (OpenAI, Ollama, LMStudio, etc.).

Requirements

  • curl
  • jq
  • either a locally running LLM or valid api keys

Installation

Using zplug:

zplug "m3at/zsh-llm-replace"

Configuration

Gemini

export ZSH_AI_COMMANDS_GEMINI_API_KEY="your-key-here"

OpenAI

export ZSH_AI_COMMANDS_OPENAI_API_KEY="your-key-here"

OpenAI-compatible APIs (llama.cpp, LMStudio, etc.)

export ZSH_AI_COMMANDS_PROVIDER=openai
export ZSH_AI_COMMANDS_OPENAI_API_KEY="your-key"
export ZSH_AI_COMMANDS_OPENAI_ENDPOINT="http://localhost:11434/v1/chat/completions"
export ZSH_AI_COMMANDS_MODEL="LiquidAI/LFM2.5-1.2B-Thinking"

All environment variables

Variable Default Purpose
ZSH_AI_COMMANDS_PROVIDER Auto-detected from which key is set gemini or openai
ZSH_AI_COMMANDS_MODEL gemini-3-flash-preview / gpt-4.1-mini Model identifier
ZSH_AI_COMMANDS_GEMINI_API_KEY Gemini API key
ZSH_AI_COMMANDS_OPENAI_API_KEY OpenAI API key
ZSH_AI_COMMANDS_OPENAI_ENDPOINT https://api.openai.com/v1/chat/completions Custom endpoint
ZSH_AI_COMMANDS_HOTKEY ^o (Ctrl+O) Keybinding
ZSH_AI_COMMANDS_HISTORY false Log queries to history
ZSH_AI_COMMANDS_DEBUG false Keep response files for debugging
ZSH_AI_COMMANDS_LLM_NAME Legacy fallback for _MODEL

Usage

  1. Type a natural language description in your terminal
  2. Press Ctrl+o (or your configured hotkey)
  3. Accept (enter) or discard (any other key) the generated command

Testing

zsh tests/run.zsh          # unit + fixture tests

Reworked based on ideas from my previous fork.

About

Zsh plugin to integrate LLM into the shell for quick command generation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages