Llm cli

From glebis/claude-skills · View interactive version

Llm cli is an AI agent skill from the GitHub repository glebis/claude-skills. 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.

How to use this skill

Skill file

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:

Example user requests:

Supported Providers & Models

OpenAI

Aliases: openai, gpt

Anthropic

Aliases: anthropic, claude

Google Gemini

Aliases: google, gemini

Ollama (Local)

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

2. Model Selection

3. Input Processing

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

Key Functions

`detect_providers()`
`get_model_selector(input_text, provider=None)`
`load_input(input_source)`
`execute_llm(content, model, interactive=False)`

Usage in Claude Code

When user invokes this skill, Claude should:

  1. Parse input for model specification (e.g., --model gpt-4o)
  2. Call skill with content and optional model parameter
  3. Wait for provider/model selection if needed
  4. Execute and return results
  5. For interactive mode, maintain conversation loop

Error Handling

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
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.