Skip to content

c0ffee0wl/llm-windows-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

66 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LLM Tools Installation Script for Windows

GitHub Repository: https://github.com/c0ffee0wl/llm-windows-setup

Automated installation script for Simon Willison's llm CLI tool and related AI/LLM command-line utilities for Windows environments.

Based on the llm-linux-setup project.

πŸ“– Looking for the Linux version? This is the Windows adaptation. For the original Linux version with additional features like AIChat (RAG), sandboxed shell execution, and more extensive documentation, see: llm-linux-setup - Linux/Debian/Ubuntu/Kali version

Features

  • βœ… One-command installation - Run once to install everything
  • βœ… Self-updating - Re-run to update all tools automatically
  • βœ… Multi-PowerShell support - Works with both PowerShell 5.1 and PowerShell 7+
  • βœ… Azure OpenAI integration - Configured for Azure Foundry
  • βœ… AI command completion - Press Ctrl+N for intelligent command suggestions
  • βœ… Automatic session recording - Terminal history captured for AI context
  • βœ… AI-powered context retrieval - Query your command history with context or llm --tool context
  • βœ… Smart admin handling - Only requires admin for Chocolatey installation

What Gets Installed

Core Tools

  • llm - LLM CLI tool (fork with markdown markup enhancements, originally by Simon Willison - Documentation)
  • Claude Code - Anthropic's agentic coding CLI
  • OpenCode - AI coding agent for terminal
  • uv - Modern Python package installer
  • Python 3 - Via Chocolatey
  • Node.js 22.x - Via Chocolatey (latest in 22 branch)
  • Git - Via Chocolatey (if not already installed)
  • jq - JSON processor

LLM Plugins

  • llm-cmd - Command execution and management
  • llm-cmd-comp - AI-powered command completion (powers Ctrl+N)
  • llm-tools-sqlite - SQLite database tool
  • llm-tools-context - Terminal history integration (exposes context tool to AI)
  • llm-fragments-site-text - Web page content extraction
  • llm-fragments-pdf - PDF content extraction
  • llm-fragments-github - GitHub repository integration
  • llm-fragments-dir - Load all text files from a local directory recursively
  • llm-jq - JSON processing tool
  • llm-templates-fabric - Fabric prompt templates
  • llm-gemini - Google Gemini models integration
  • llm-vertex - Google Vertex AI integration (enterprise API)
  • llm-openrouter - OpenRouter API integration
  • llm-anthropic - Anthropic Claude models integration

LLM Templates

  • assistant.yaml - Custom assistant template with security/IT expertise configuration
  • code.yaml - Code-only generation template (outputs clean, executable code without markdown)

Additional Tools

  • gitingest - Convert Git repositories to LLM-friendly text
  • files-to-prompt - File content formatter for LLM prompts
  • context - PowerShell history extraction for AI context retrieval

PowerShell Integration

  • AI-powered command completion (Ctrl+N)
  • Custom llm wrapper with default assistant template
  • Automatic PowerShell transcript logging for AI context
  • Clipboard aliases (pbcopy, pbpaste) for macOS compatibility
  • PATH configuration for all installed tools

System Requirements

  • OS: Windows 10, Windows 11, or Windows Server 2016+
  • PowerShell: 5.1 or higher (PowerShell 7+ supported)
  • Internet: Required for installation and API access
  • Disk Space: ~1GB for all tools and dependencies
  • Admin Rights: Only required for initial Chocolatey installation

Installation

Quick Start

  1. Clone the repository:

    git clone https://github.com/c0ffee0wl/llm-windows-setup.git
    cd llm-windows-setup
  2. Run the installation script:

    • If Chocolatey is NOT installed (first-time installation):

      # Run as Administrator (required for Chocolatey installation)
      .\Install-LlmTools.ps1
    • If Chocolatey IS already installed:

      # Can run as regular user
      .\Install-LlmTools.ps1
  3. Follow the prompts:

    • You'll be asked if you want to configure Azure OpenAI (optional)
    • If yes, provide your Azure API key and resource URL

Execution Policy

If you get an execution policy error, run:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Updating

Simply re-run the installation script:

cd llm-windows-setup
.\Install-LlmTools.ps1

The script will automatically:

  1. Check for script updates from the git repository
  2. Pull latest changes and re-execute if updates are found
  3. Update llm and all plugins
  4. Update custom templates (assistant.yaml)
  5. Update gitingest, files-to-prompt, Claude Code, and OpenCode
  6. Refresh PowerShell integration files

Note: Updates do not require Administrator privileges (unless you need to update Chocolatey packages). The git pull happens automatically during Phase 0.

Usage

Basic LLM Usage

# Ask a question (uses assistant template by default)
llm "What is the capital of France?"

# Start an interactive chat session
llm chat "Let's discuss PowerShell"

# Use a specific model
llm -m azure/gpt-5 "Explain quantum computing"

# List available models
llm models list

# View installed plugins
llm plugins

AI Command Completion

Type a partial command or describe what you want in natural language, then press Ctrl+N:

# Type: list all json files recursively
# Press Ctrl+N
# Result: Get-ChildItem -Recurse -Filter *.json

The AI will suggest and insert the command automatically.

Azure OpenAI Models

The following models are configured (if you set up Azure OpenAI):

  • azure/gpt-4.1-mini - GPT-4.1 Mini (default, recommended for most tasks)
  • azure/gpt-4.1 - GPT-4.1 (recommended for complex tasks)
  • azure/gpt-4.1-nano - GPT-4.1 Nano (lightweight)
  • azure/gpt-5 - GPT-5 (most capable)
  • azure/gpt-5-mini - GPT-5 Mini (advanced reasoning)
  • azure/gpt-5-nano - GPT-5 Nano (advanced lightweight)
  • azure/o4-mini - O4 Mini

To switch models for more complex tasks:

llm models default azure/gpt-4.1

Clipboard Aliases (macOS Compatibility)

# Copy to clipboard (like macOS pbcopy)
"Hello World" | pbcopy

# Paste from clipboard (like macOS pbpaste)
pbpaste

Additional Tools

# Convert Git repositories to LLM-friendly text
gitingest https://github.com/user/repo
gitingest C:\path\to\local\repo

# Convert files to LLM-friendly format
files-to-prompt src\*.py

# Use OpenCode
opencode

# Use Claude Code
claude

Context System (PowerShell History for AI)

PowerShell sessions are automatically logged via transcript recording. The AI can retrieve your terminal history for better context:

# Show last command
context

# Show last 5 commands
context 5

# Show entire session history
context all

# Check transcript file location
$env:TRANSCRIPT_LOG_FILE

# Check transcript directory
$env:TRANSCRIPT_LOG_DIR

How it works:

  • Each PowerShell session automatically starts transcript logging
  • Transcripts are stored in $env:TRANSCRIPT_LOG_DIR (configurable during installation)
  • The context command parses transcripts and extracts command history
  • The llm-tools-context plugin exposes this to AI models for contextual assistance
  • AI can call context(N) to retrieve last N commands when helping with your tasks

Storage options:

  • Temporary (default): %TEMP%\PowerShell_Transcripts - cleared on logout/reboot
  • Permanent: %USERPROFILE%\PowerShell_Transcripts - survives reboots

Configuration

Configuration Files

  • %APPDATA%\io.datasette.llm\ - LLM configuration directory
    • extra-openai-models.yaml - Azure OpenAI model definitions
    • templates\assistant.yaml - Custom assistant template (auto-installed)
    • API keys stored securely via llm's key management

PowerShell Integration Files

Located in the integration\ subdirectory:

  • integration\llm-integration.ps1 - Unified integration for PS5 & PS7

This file is automatically sourced from your PowerShell profile.

PowerShell Profile Locations

The installation script adds integration to:

  • PowerShell 5: %USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
  • PowerShell 7: %USERPROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

Changing Default Model

llm models default azure/gpt-4.1

Managing API Keys

# Set Azure key
llm keys set azure

# View key storage path
llm keys path

# List all configured keys
llm keys

Troubleshooting

Command completion not working

  1. Restart your PowerShell session or reload your profile:

    . $PROFILE
  2. Verify llm is in PATH:

    Get-Command llm
  3. Test llm command completion manually:

    llm cmdcomp "list files"
  4. Check if PSReadLine is loaded:

    Get-Module PSReadLine

Azure API errors

  1. Verify API key is set:

    llm keys get azure
  2. Check model configuration:

    Get-Content $env:APPDATA\io.datasette.llm\extra-openai-models.yaml
  3. Update the API base URL in the YAML file if needed

"llm" command not found

  1. Check if the installation completed successfully
  2. Verify PATH includes: %USERPROFILE%\.local\bin
  3. Restart PowerShell
  4. Re-run the installation script

Chocolatey installation fails

  1. Ensure you're running PowerShell as Administrator
  2. Check your internet connection
  3. Verify your execution policy allows scripts:
    Get-ExecutionPolicy
  4. Install Chocolatey manually: https://chocolatey.org/install

npm permissions errors

The script configures npm to use user-level global installs. If you still get permission errors:

npm config set prefix "$env:USERPROFILE\.npm-global"

Then add %USERPROFILE%\.npm-global to your PATH.

Supported PowerShell Versions

  • PowerShell 5.1 (Windows PowerShell - included with Windows 10/11)
  • PowerShell 7.x (PowerShell Core - cross-platform)

Documentation

Differences from Linux Version

This Windows version differs from the Linux version in the following ways:

πŸ“š Note: The Linux version contains more extensive documentation, detailed usage examples, and additional features. Refer to its README for comprehensive guides on fragments, templates, RAG, and advanced workflows.

Platform & Package Management

Windows:

  • Uses Chocolatey for system packages (Python, Node.js, Git, jq)
  • Smart admin privilege model (admin only required for Chocolatey on first run)
  • User-scoped installations for everything else (pipx, uv, npm global)

Linux:

  • Uses apt/dpkg for system packages
  • rustup for Rust toolchain management (required for aichat/argc)
  • nvm for Node.js version management (if repository version < 20)
  • Root/sudo access required for system package installation

Shell Integration

Windows:

  • PowerShell 5.1 and 7+ support
  • Single integration file (llm-integration.ps1) works for both PS versions
  • Uses PSReadLine for Ctrl+N command completion
  • Clipboard aliases: pbcopy/pbpaste functions

Linux:

  • Bash and Zsh support
  • Three-file integration pattern:
    • llm-common.sh - Shared configuration
    • llm-integration.bash - Bash-specific widgets
    • llm-integration.zsh - Zsh-specific widgets
  • llm-zsh-plugin - Tab completion for llm commands (Zsh only)
  • Clipboard aliases via xsel (macOS compatibility layer)

Session Recording & Context System

Windows:

  • Uses native PowerShell Start-Transcript cmdlet
  • Creates .txt transcript files (UTF-16-LE or UTF-8 encoding)
  • Stores in %TEMP%\PowerShell_Transcripts (temporary) or %USERPROFILE%\PowerShell_Transcripts (permanent)
  • One transcript per PowerShell window/tab
  • Parses transcript files with context.py (indentation-based parsing)
  • Limitation: Native commands (ping, git, etc.) output not always captured by PowerShell transcription

Linux:

  • Uses asciinema for terminal recording (built from source for latest features)
  • Creates .cast files (asciinema JSON format)
  • Stores in /tmp/session_logs/asciinema (temporary) or ~/session_logs/asciinema (permanent)
  • Tmux/screen support: Each pane/window gets independent recording with unique session files
  • Parses .cast files with context script (regex-based prompt detection)
  • Full command output capture including native commands

LLM Assistant Template Differences

Windows (assistant.yaml):

  • Tools: context only

Linux (assistant.yaml):

  • Tools: context + sandboxed_shell (bubblewrap-based safe command execution)

Tools & Features Exclusive to Linux Version

The Linux version includes several additional tools not present in the Windows version:

AIChat (RAG Functionality)

  • AIChat - All-in-one LLM CLI with built-in RAG (Retrieval-Augmented Generation)
  • Built-in vector database for document querying
  • Query codebases, documents, and knowledge bases: llm rag mydocs
  • Supports multiple document sources (Git repos, URLs, PDFs, DOCX, directories)
  • Auto-configured with Azure OpenAI settings

Additional LLM Plugins

The Linux version includes several additional LLM plugins not available in the Windows version:

Fragment Plugins:

  • llm-fragments-youtube-transcript - YouTube video transcript extraction with metadata

Tool Plugins:

  • llm-tools-sandboxed-shell - Safe shell command execution (covered in Sandboxed Command Execution section below)
  • llm-tools-patch - File manipulation tools (read, write, edit, multi_edit, info) with approval workflow
  • llm-tools-llm-functions - Bridge for llm-functions framework (covered in Developer Tools section below)
  • llm-tools-quickjs - JavaScript execution environment for AI

Sandboxed Command Execution

  • llm-tools-sandboxed-shell - Execute shell commands safely using bubblewrap
  • Isolated environment (read-only root, no network access, Linux namespaces)
  • Built into the Linux assistant template by default
  • Requires bubblewrap (automatically installed)

Developer Tools & Frameworks

  • Rust/Cargo toolchain - Required for building aichat and argc
  • argc - Bash CLI framework and command runner (enables llm-functions integration)
  • yek - Fast Rust-based repository to LLM-friendly text converter (230x faster than gitingest)

Document Processing

  • poppler-utils - PDF text extraction (pdftotext)
  • pandoc - Document converter (DOCX support for RAG)

What's the Same

Both versions share these core features:

  • βœ… llm CLI tool - Simon Willison's LLM CLI
  • βœ… Self-updating installation scripts - git pull before execution
  • βœ… Azure OpenAI integration - Configured for Azure Foundry
  • βœ… AI command completion - Ctrl+N intelligent command suggestions via llm cmdcomp
  • βœ… Context system - Query terminal history with AI
  • βœ… Custom templates - assistant.yaml (security/IT expertise) and code.yaml (clean code output)
  • βœ… Core LLM plugins - gemini, openrouter, anthropic, vertex, jq, sqlite, cmd, cmd-comp, fabric templates
  • βœ… Shared fragment plugins - site-text, pdf, github, dir (Linux has 1 additional: youtube-transcript)
  • βœ… Shared tool plugins - sqlite, context (Linux has 3 additional: quickjs, patch, sandboxed-shell)
  • βœ… Additional tools - gitingest, files-to-prompt, Claude Code, OpenCode
  • βœ… Smart template application - Shell wrapper auto-applies assistant template

License

This installation script is provided as-is under the MIT License. Individual tools have their own licenses:

  • llm: Apache 2.0
  • See individual tool repositories for details

Contributing

To modify or extend this installation:

  1. Fork the repository
  2. Make your changes
  3. Test on Windows 10/11
  4. Submit a pull request

Credits

Support

For issues, questions, or suggestions:

Related Projects

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •