llm

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

LLM CLI Tool Skill

LLM CLI 工具技能

A CLI tool and Python library for interacting with Large Language Models including OpenAI, Anthropic's Claude, Google's Gemini, Meta's Llama, and dozens of others via remote APIs or locally installed models.
这是一个CLI工具和Python库,用于与大语言模型交互,包括OpenAI、Anthropic的Claude、Google的Gemini、Meta的Llama等,支持通过远程API或本地安装的模型进行访问。

When to Use This Skill

何时使用此技能

Use this skill when:
  • Running prompts against LLMs from the command line
  • Managing conversations and chat sessions
  • Working with embeddings for semantic search
  • Extracting structured data using schemas
  • Installing and configuring LLM plugins
  • Managing API keys for various providers
  • Using templates for reusable prompts
  • Logging and analyzing LLM interactions
在以下场景使用此技能:
  • 从命令行向LLM发送提示词
  • 管理对话和会话
  • 处理用于语义搜索的向量嵌入
  • 使用Schema提取结构化数据
  • 安装和配置LLM插件
  • 管理不同提供商的API密钥
  • 使用可复用的提示词模板
  • 记录和分析与LLM的交互

Quick Reference

快速参考

Basic Commands

基础命令

bash
undefined
bash
undefined

Run a prompt

运行提示词

llm "Your prompt here"
llm "Your prompt here"

Use a specific model

使用特定模型

llm -m claude-4-opus "Your prompt"
llm -m claude-4-opus "Your prompt"

Chat mode

聊天模式

llm chat -m gpt-4.1
llm chat -m gpt-4.1

With attachments (images, audio, video)

附带附件(图片、音频、视频)

llm "describe this" -a image.jpg
llm "describe this" -a image.jpg

Pipe content

管道输入内容

cat file.py | llm -s "Explain this code"
undefined
cat file.py | llm -s "Explain this code"
undefined

Key Management

密钥管理

bash
llm keys set openai
llm keys set anthropic
llm keys set gemini
bash
llm keys set openai
llm keys set anthropic
llm keys set gemini

Plugin Management

插件管理

bash
llm install llm-anthropic
llm install llm-gemini
llm install llm-ollama
llm plugins
bash
llm install llm-anthropic
llm install llm-gemini
llm install llm-ollama
llm plugins

Documentation Index

文档索引

Core Documentation

核心文档

  • README.md - Project overview and quick start guide
  • docs/setup.md - Installation and initial configuration
  • docs/usage.md - Comprehensive CLI usage guide (prompts, chat, attachments, conversations)
  • docs/help.md - Complete command reference and help text
  • README.md - 项目概述与快速入门指南
  • docs/setup.md - 安装与初始配置
  • docs/usage.md - 全面的CLI使用指南(提示词、聊天、附件、会话)
  • docs/help.md - 完整的命令参考与帮助文本

Model Configuration

模型配置

  • docs/openai-models.md - OpenAI model configuration and features
  • docs/other-models.md - Configuration for other model providers
  • docs/openai-models.md - OpenAI模型配置与功能
  • docs/other-models.md - 其他模型提供商的配置

Advanced Features

高级功能

  • docs/tools.md - Tool use and function calling with LLMs
  • docs/schemas.md - Structured data extraction from text and images
  • docs/templates.md - Creating and using prompt templates
  • docs/fragments.md - Long context support using fragments
  • docs/aliases.md - Creating model aliases
  • docs/tools.md - LLM的工具使用与函数调用
  • docs/schemas.md - 从文本和图像中提取结构化数据
  • docs/templates.md - 创建和使用提示词模板
  • docs/fragments.md - 使用片段实现长上下文支持
  • docs/aliases.md - 创建模型别名

Embeddings

向量嵌入

  • docs/embeddings/index.md - Embeddings overview
  • docs/embeddings/cli.md - Embeddings CLI commands
  • docs/embeddings/python-api.md - Embeddings Python API
  • docs/embeddings/storage.md - Embeddings storage system
  • docs/embeddings/writing-plugins.md - Writing embedding plugins
  • docs/embeddings/index.md - 向量嵌入概述
  • docs/embeddings/cli.md - 向量嵌入CLI命令
  • docs/embeddings/python-api.md - 向量嵌入Python API
  • docs/embeddings/storage.md - 向量嵌入存储系统
  • docs/embeddings/writing-plugins.md - 编写嵌入插件

Plugins

插件

  • docs/plugins/index.md - Plugin system overview
  • docs/plugins/installing-plugins.md - Installing and managing plugins
  • docs/plugins/directory.md - Plugin directory listing
  • docs/plugins/tutorial-model-plugin.md - Tutorial: Creating a model plugin
  • docs/plugins/advanced-model-plugins.md - Advanced plugin development
  • docs/plugins/plugin-hooks.md - Plugin hooks reference
  • docs/plugins/plugin-utilities.md - Plugin utility functions
  • docs/plugins/index.md - 插件系统概述
  • docs/plugins/installing-plugins.md - 安装与管理插件
  • docs/plugins/directory.md - 插件目录列表
  • docs/plugins/tutorial-model-plugin.md - 教程:创建模型插件
  • docs/plugins/advanced-model-plugins.md - 高级插件开发
  • docs/plugins/plugin-hooks.md - 插件钩子参考
  • docs/plugins/plugin-utilities.md - 插件实用工具函数

Python API & Development

Python API 与开发

  • docs/python-api.md - Python library API reference
  • docs/logging.md - Logging system and SQLite storage
  • docs/contributing.md - Contributing to LLM development
  • docs/python-api.md - Python库API参考
  • docs/logging.md - 日志系统与SQLite存储
  • docs/contributing.md - 为LLM开发做贡献

Reference

参考

  • docs/related-tools.md - Related tools and ecosystem
  • docs/changelog.md - Version history and changes
  • docs/related-tools.md - 相关工具与生态系统
  • docs/changelog.md - 版本历史与更新记录

Common Workflows

常见工作流

Starting a Conversation

开始对话

bash
undefined
bash
undefined

Start chat with context

启动带上下文的聊天

llm chat -m gpt-4.1 -s "You are a helpful coding assistant"
llm chat -m gpt-4.1 -s "You are a helpful coding assistant"

Continue a previous conversation

继续之前的对话

llm -c "Follow up question"
undefined
llm -c "Follow up question"
undefined

Working with Files

处理文件

bash
undefined
bash
undefined

Analyze code

分析代码

cat script.py | llm "Review this code for bugs"
cat script.py | llm "Review this code for bugs"

Process multiple files

处理多个文件

cat *.md | llm "Summarize these documents"
undefined
cat *.md | llm "Summarize these documents"
undefined

Structured Output

结构化输出

bash
undefined
bash
undefined

Extract data with schema

使用Schema提取数据

llm -m gpt-4.1 "Extract person info" -a photo.jpg --schema name,age,occupation
undefined
llm -m gpt-4.1 "Extract person info" -a photo.jpg --schema name,age,occupation
undefined

Template Usage

模板使用

bash
undefined
bash
undefined

List templates

列出模板

llm templates
llm templates

Use a template

使用模板

llm -t summarize < article.txt
undefined
llm -t summarize < article.txt
undefined

Included Templates

内置模板

This skill includes ready-to-use prompt templates in
templates/
.
此技能在
templates/
目录中包含了可直接使用的提示词模板。

audio-to-article.yaml

audio-to-article.yaml

Transforms raw audio transcripts into polished, readable articles. Used by the
/audio-to-article
command.
bash
undefined
将原始音频转录文本转换为流畅、易读的文章。可通过
/audio-to-article
命令调用。
bash
undefined

Use with a transcript

配合转录文本使用

cat transcript.txt | llm -t templates/audio-to-article.yaml
cat transcript.txt | llm -t templates/audio-to-article.yaml

Or with the full path

或使用完整路径

python3 ../parakeet/srt_to_text.py audio.srt | llm -t templates/audio-to-article.yaml

**What it does:**
- Removes filler words (um, uh, like, you know)
- Fixes transcription errors from context
- Adds paragraph breaks at topic transitions
- Creates section headers where topics shift
- Preserves the speaker's voice and meaning
- Outputs clean markdown with title

**Related skills:**
- **parakeet** - Transcribes audio to SRT, includes `srt_to_text.py` helper for conversion
- **yt-dlp** - Downloads audio from URLs (YouTube, podcasts, etc.)
python3 ../parakeet/srt_to_text.py audio.srt | llm -t templates/audio-to-article.yaml

**功能说明:**
- 移除填充词(um、uh、like、you know等)
- 根据上下文修正转录错误
- 在主题转换处添加段落分隔
- 在主题切换时创建章节标题
- 保留说话者的语气与原意
- 输出带标题的整洁Markdown格式

**相关技能:**
- **parakeet** - 将音频转录为SRT格式,包含`srt_to_text.py`辅助工具用于格式转换
- **yt-dlp** - 从URL下载音频(YouTube、播客等)