LLM CLI Skill
Purpose
This skill enables seamless interaction with multiple LLM providers (OpenAI, Anthropic, Google Gemini, Ollama) through the llm CLI tool. It processes textual and multimedia information with support for both one-off executions and interactive conversation modes.
When to Use This Skill
Trigger this skill when:
- User wants to process text/files with an LLM
- User needs to choose between multiple available LLMs
- User wants interactive conversation with an LLM
- User needs to pipe content through an LLM for processing
- User wants to use specific model aliases (e.g., "claude-opus", "gpt-4o")
Example user requests:
- "Process this file with Claude"
- "Analyze this text with the fastest available model"
- "Start an interactive chat with OpenAI"
- "Use Gemini to summarize this document"
- "Chat mode with my local Ollama instance"
Supported Providers & Models
OpenAI
- Latest Models (2025):
gpt-5 - Most advanced model
gpt-4-1 / gpt-4.1 - Latest high-performance
gpt-4-1-mini / gpt-4.1-mini - Smaller, faster version
gpt-4o - Multimodal omni model
gpt-4o-mini - Lightweight multimodal
o3 - Advanced reasoning
o3-mini / o3-mini-high - Reasoning variants
Aliases: openai, gpt
Anthropic
- Latest Models (2025):
claude-sonnet-4.5 - Latest flagship model
claude-opus-4.1 - Complex task specialist
claude-opus-4 - Coding specialist
claude-sonnet-4 - Balanced performance
claude-3.5-sonnet - Previous generation
claude-3.5-haiku - Fast & efficient
Aliases: anthropic, claude
Google Gemini
- Latest Models (2025):
gemini-2.5-pro - Most advanced
gemini-3.5-flash-lite - Default fast model
gemini-2.5-flash-lite - Speed optimized
gemini-2.0-flash - Previous generation
gemini-2.5-computer-use - UI interaction
Aliases: google, gemini
Ollama (Local)
- Popular Models:
llama3.1 - Meta's latest (8b, 70b, 405b)
llama3.2 - Compact versions (1b, 3b)
mistral-large-2 - Mistral flagship
deepseek-coder - Code specialist
starcode2 - Code models
Aliases: ollama, local
Workflow Overview
User Input (with optional model)
↓
Check Available Providers (env vars)
↓
Determine Model to Use:
- If specified: Use provided model
- If ambiguous: Show selection menu
- Otherwise: Use last remembered choice
↓
Load/Create Config (~/.claude/llm-skill-config.json)
↓
Detect Input Type:
- stdin/piped
- file path
- inline text
↓
Execute llm CLI:
- Non-interactive: Process & return
- Interactive: Keep conversation loop
↓
Save Model Choice to Config
Features
1. Provider Detection
- Checks environment variables for API keys
- Suggests available LLM providers on first run
- Detects:
OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY, OLLAMA_BASE_URL
2. Model Selection
- Accept model aliases (
gpt-4o, claude-opus, gemini-2.5-pro)
- Accept provider aliases (
openai, anthropic, google, ollama)
- Interactive menu when selection is ambiguous
- Remembers last used model in
~/.claude/llm-skill-config.json
3. Input Processing
- Accepts stdin/piped input
- Processes file paths (detects: .txt, .md, .json, .pdf, images)
- Handles inline text prompts
- Supports multimedia files with appropriate encoding
4. Execution Modes
Non-Interactive (Default)
llm "Your prompt here"
llm --model gpt-4o "Process this text"
llm < file.txt
cat document.md | llm "Summarize"
Interactive Mode
llm --interactive
llm -i
llm --model claude-opus --interactive
5. Configuration
Persistent config location: ~/.claude/llm-skill-config.json
{
"last_model": "claude-sonnet-4.5",
"default_provider": "anthropic",
"available_providers": ["openai", "anthropic", "google", "ollama"]
}
Implementation Details
Core Files
llm_skill.py - Main skill orchestration
providers.py - Provider detection & config
models.py - Model definitions & aliases
executor.py - Execution logic (interactive/non-interactive)
input_handler.py - Input type detection
Key Functions
detect_providers()
- Scans environment for provider API keys
- Returns dict of available providers
get_model_selector(input_text, provider=None)
- Returns selected model, showing menu if needed
- Respects
last_model config preference
load_input(input_source)
- Handles stdin, file paths, or inline text
- Returns content string
execute_llm(content, model, interactive=False)
- Calls
llm CLI with appropriate parameters
- Manages stdin/stdout for interactive mode
Usage in Claude Code
When user invokes this skill, Claude should:
- Parse input for model specification (e.g.,
--model gpt-4o)
- Call skill with content and optional model parameter
- Wait for provider/model selection if needed
- Execute and return results
- For interactive mode, maintain conversation loop
Error Handling
- If no providers available: Suggest installing API keys
- If model not found: Show available models for chosen provider
- If llm CLI not installed: Suggest installation via
pip install llm
- If file not readable: Fall back to treating as inline text
Configuration
Users can pre-configure preferences:
{
"last_model": "claude-sonnet-4.5",
"default_provider": "anthropic",
"interactive_mode": false,
"available_providers": ["openai", "anthropic"]
}
Slash Command Integration
Support /llm command:
/llm process this text
/llm --interactive
/llm --model gpt-4o analyze this
1---2name: llm-cli3description: Process textual and multimedia files with various LLM providers using the llm CLI. Supports both non-interactive and interactive modes with model selection, config persistence, and file input handling.4metadata:5 source: https://skillmd.com/skills/glebis/llm-cli6---78# LLM CLI Skill910## Purpose1112This skill enables seamless interaction with multiple LLM providers (OpenAI, Anthropic, Google Gemini, Ollama) through the `llm` CLI tool. It processes textual and multimedia information with support for both one-off executions and interactive conversation modes.1314## When to Use This Skill1516Trigger this skill when:17- User wants to process text/files with an LLM18- User needs to choose between multiple available LLMs19- User wants interactive conversation with an LLM20- User needs to pipe content through an LLM for processing21- User wants to use specific model aliases (e.g., "claude-opus", "gpt-4o")2223Example user requests:24- "Process this file with Claude"25- "Analyze this text with the fastest available model"26- "Start an interactive chat with OpenAI"27- "Use Gemini to summarize this document"28- "Chat mode with my local Ollama instance"2930## Supported Providers & Models3132### OpenAI33- **Latest Models (2025)**:34 - `gpt-5` - Most advanced model35 - `gpt-4-1` / `gpt-4.1` - Latest high-performance36 - `gpt-4-1-mini` / `gpt-4.1-mini` - Smaller, faster version37 - `gpt-4o` - Multimodal omni model38 - `gpt-4o-mini` - Lightweight multimodal39 - `o3` - Advanced reasoning40 - `o3-mini` / `o3-mini-high` - Reasoning variants4142**Aliases**: `openai`, `gpt`4344### Anthropic45- **Latest Models (2025)**:46 - `claude-sonnet-4.5` - Latest flagship model47 - `claude-opus-4.1` - Complex task specialist48 - `claude-opus-4` - Coding specialist49 - `claude-sonnet-4` - Balanced performance50 - `claude-3.5-sonnet` - Previous generation51 - `claude-3.5-haiku` - Fast & efficient5253**Aliases**: `anthropic`, `claude`5455### Google Gemini56- **Latest Models (2025)**:57 - `gemini-2.5-pro` - Most advanced58 - `gemini-3.5-flash-lite` - Default fast model59 - `gemini-2.5-flash-lite` - Speed optimized60 - `gemini-2.0-flash` - Previous generation61 - `gemini-2.5-computer-use` - UI interaction6263**Aliases**: `google`, `gemini`6465### Ollama (Local)66- **Popular Models**:67 - `llama3.1` - Meta's latest (8b, 70b, 405b)68 - `llama3.2` - Compact versions (1b, 3b)69 - `mistral-large-2` - Mistral flagship70 - `deepseek-coder` - Code specialist71 - `starcode2` - Code models7273**Aliases**: `ollama`, `local`7475## Workflow Overview7677```78User Input (with optional model)79 ↓80Check Available Providers (env vars)81 ↓82Determine Model to Use:83 - If specified: Use provided model84 - If ambiguous: Show selection menu85 - Otherwise: Use last remembered choice86 ↓87Load/Create Config (~/.claude/llm-skill-config.json)88 ↓89Detect Input Type:90 - stdin/piped91 - file path92 - inline text93 ↓94Execute llm CLI:95 - Non-interactive: Process & return96 - Interactive: Keep conversation loop97 ↓98Save Model Choice to Config99```100101## Features102103### 1. Provider Detection104- Checks environment variables for API keys105- Suggests available LLM providers on first run106- Detects: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`, `OLLAMA_BASE_URL`107108### 2. Model Selection109- Accept model aliases (`gpt-4o`, `claude-opus`, `gemini-2.5-pro`)110- Accept provider aliases (`openai`, `anthropic`, `google`, `ollama`)111- Interactive menu when selection is ambiguous112- Remembers last used model in `~/.claude/llm-skill-config.json`113114### 3. Input Processing115- Accepts stdin/piped input116- Processes file paths (detects: .txt, .md, .json, .pdf, images)117- Handles inline text prompts118- Supports multimedia files with appropriate encoding119120### 4. Execution Modes121122#### Non-Interactive (Default)123```bash124llm "Your prompt here"125llm --model gpt-4o "Process this text"126llm < file.txt127cat document.md | llm "Summarize"128```129130#### Interactive Mode131```bash132llm --interactive133llm -i134llm --model claude-opus --interactive135```136137### 5. Configuration138Persistent config location: `~/.claude/llm-skill-config.json`139```json140{141 "last_model": "claude-sonnet-4.5",142 "default_provider": "anthropic",143 "available_providers": ["openai", "anthropic", "google", "ollama"]144}145```146147## Implementation Details148149### Core Files150- `llm_skill.py` - Main skill orchestration151- `providers.py` - Provider detection & config152- `models.py` - Model definitions & aliases153- `executor.py` - Execution logic (interactive/non-interactive)154- `input_handler.py` - Input type detection155156### Key Functions157158#### `detect_providers()`159- Scans environment for provider API keys160- Returns dict of available providers161162#### `get_model_selector(input_text, provider=None)`163- Returns selected model, showing menu if needed164- Respects `last_model` config preference165166#### `load_input(input_source)`167- Handles stdin, file paths, or inline text168- Returns content string169170#### `execute_llm(content, model, interactive=False)`171- Calls `llm` CLI with appropriate parameters172- Manages stdin/stdout for interactive mode173174### Usage in Claude Code175176When user invokes this skill, Claude should:1771. Parse input for model specification (e.g., `--model gpt-4o`)1782. Call skill with content and optional model parameter1793. Wait for provider/model selection if needed1804. Execute and return results1815. For interactive mode, maintain conversation loop182183## Error Handling184185- If no providers available: Suggest installing API keys186- If model not found: Show available models for chosen provider187- If llm CLI not installed: Suggest installation via `pip install llm`188- If file not readable: Fall back to treating as inline text189190## Configuration191192Users can pre-configure preferences:193```json194{195 "last_model": "claude-sonnet-4.5",196 "default_provider": "anthropic",197 "interactive_mode": false,198 "available_providers": ["openai", "anthropic"]199}200```201202## Slash Command Integration203204Support `/llm` command:205```206/llm process this text207/llm --interactive208/llm --model gpt-4o analyze this209```