llm

Access large language models from the command-line

open-sourceagent-frameworks
11.5k
Stars
+180
Stars/month
2
Releases (6m)

Star Growth

+37 (0.3%)
11.2k11.5k11.7kMar 27Apr 1

Overview

llm 是一个强大的命令行工具和 Python 库,用于与多个大语言模型提供商进行交互,包括 OpenAI、Anthropic Claude、Google Gemini、Meta Llama 等数十种模型。它支持远程 API 调用和本地模型运行,为开发者提供了统一的接口来访问各种 LLM 服务。该工具具有丰富的功能集,包括命令行提示执行、SQLite 数据库中的对话历史存储、向量嵌入生成、结构化内容提取、以及工具执行能力。llm 由 Simon Willison 开发,在 GitHub 上拥有超过 11,000 星标,是一个成熟且活跃维护的项目。它特别适合需要在不同 LLM 提供商之间切换、进行批量处理、或需要本地存储对话历史的开发者和研究人员。

Deep Analysis

Key Differentiator

vs direct API calls: Swiss-army-knife CLI that unifies 100+ LLMs behind one command, with automatic SQLite logging, embeddings, schemas, and a rich plugin ecosystem

Capabilities

  • CLI tool for interacting with LLMs
  • Python library for LLM integration
  • SQLite conversation logging
  • Embedding generation and storage
  • Structured data extraction with schemas
  • Tool/function calling support
  • Plugin system for model providers
  • Interactive chat mode

🔗 Integrations

OpenAIAnthropic ClaudeGoogle GeminiOllama100+ models via plugins

Best For

  • Power users who want LLM access from the terminal
  • Quick prototyping and experimentation with multiple LLM providers
  • Building CLI-based LLM workflows with conversation history

Not Ideal For

  • Building production web applications
  • Teams needing a shared LLM management platform

Languages

Python

Deployment

pip installHomebrewpipxuv tool install

Pricing Detail

Free: Fully free and open-source (Apache 2.0); model API costs apply
Paid: N/A - bring your own API keys

Known Limitations

  • CLI-focused, not a web framework
  • Plugin ecosystem quality varies
  • SQLite storage not ideal for team/shared use

Pros

  • + 统一接口支持数十种 LLM 提供商,包括主流的 OpenAI、Claude、Gemini 等,避免了学习多套 API 的复杂性
  • + 内置 SQLite 数据库自动存储所有提示和响应,便于历史记录管理、成本追踪和数据分析
  • + 支持本地模型运行和向量嵌入生成,提供了完整的 AI 工作流解决方案,无需依赖多个工具

Cons

  • - 需要为各个 LLM 提供商单独配置 API 密钥,初始设置可能较为繁琐
  • - 作为命令行工具,对于不熟悉终端操作的用户可能存在学习门槛
  • - 高级功能如结构化数据提取和工具执行需要一定的编程知识才能充分利用

Use Cases

  • AI 研究和实验:快速测试不同模型的性能表现,比较各家 LLM 在特定任务上的输出质量
  • 批量内容处理:使用脚本自动化处理大量文本,进行翻译、总结、分类等批处理任务
  • 开发环境集成:在 CI/CD 流水线中集成 AI 能力,进行代码审查、文档生成或测试用例创建

Getting Started

使用 pip install llm 或 brew install llm 安装工具,然后通过 llm keys set openai 配置 API 密钥,最后运行 llm '你好,请介绍一下自己' 开始第一次对话

Compare llm