Files
simonw--llm/README.md
T
wehub-resource-sync 3db29810ba
Test / test (macos-latest, 3.11, ) (push) Has been cancelled
Test / test (macos-latest, 3.12, ) (push) Has been cancelled
Test / test (macos-latest, 3.13, ) (push) Has been cancelled
Update Stable Docs / update_stable_docs (push) Has been cancelled
Test / test (macos-latest, 3.10, ) (push) Has been cancelled
Test / test (macos-latest, 3.14, ) (push) Has been cancelled
Test / test (ubuntu-latest, 3.10, ) (push) Has been cancelled
Test / test (ubuntu-latest, 3.11, ) (push) Has been cancelled
Test / test (ubuntu-latest, 3.12, ) (push) Has been cancelled
Test / test (ubuntu-latest, 3.13, ) (push) Has been cancelled
Test / test (ubuntu-latest, 3.14, ) (push) Has been cancelled
Test / test (ubuntu-latest, 3.14, 4.0rc4) (push) Has been cancelled
Test / test (windows-latest, 3.10, ) (push) Has been cancelled
Test / test (windows-latest, 3.11, ) (push) Has been cancelled
Test / test (windows-latest, 3.12, ) (push) Has been cancelled
Test / test (windows-latest, 3.13, ) (push) Has been cancelled
Test / test (windows-latest, 3.14, ) (push) Has been cancelled
docs: make Chinese README the default
2026-07-13 10:48:35 +00:00

28 KiB
Raw Blame History

Note

本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
English · 原始项目 · 上游 README
原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。

LLM

GitHub 仓库 PyPI 更新日志 测试 许可证 Discord Homebrew

一款 CLI 工具和 Python 库,用于与 OpenAIAnthropic 的 ClaudeGoogle 的 GeminiMeta 的 Llama 以及数十种其他大语言模型(Large Language ModelLLM)交互,既可通过远程 API,也可使用可在你本机安装和运行的模型。

在 YouTube 上观看 命令行上的语言模型 演示,或阅读配套的详细笔记.

使用 LLM,你可以:

快速入门

首先,使用 pip 或 Homebrew 或 pipxuv 安装 LLM

pip install llm

或使用 Homebrew(参见警告说明):

brew install llm

或使用 pipx:

pipx install llm

或使用 uv

uv tool install llm

如果你有 OpenAI API 密钥,可以运行以下命令:

# Paste your OpenAI API key into this
llm keys set openai

# Run a prompt (with the default gpt-4o-mini model)
llm "Ten fun names for a pet pelican"

# Extract text from an image
llm "extract text" -a scanned-document.jpg

# Use a system prompt against a file
cat myfile.py | llm -s "Explain this code"

使用各自插件对 GeminiAnthropic 运行提示词:

llm install llm-gemini
llm keys set gemini
# Paste Gemini API key here
llm -m gemini-2.0-flash 'Tell me fun facts about Mountain View'

llm install llm-anthropic
llm keys set anthropic
# Paste Anthropic API key here
llm -m claude-4-opus 'Impress me with wild facts about turnips'

你还可以安装插件 以访问可在本地设备上运行的模型。如果你使用 Ollama:

# Install the plugin
llm install llm-ollama

# Download and run a prompt against the Orca Mini 7B model
ollama pull llama3.2:latest
llm -m llama3.2:latest 'What is the capital of France?'

要启动与模型的交互式聊天,请使用 llm chat

llm chat -m gpt-4.1
Chatting with gpt-4.1
Type 'exit' or 'quit' to exit
Type '!multi' to enter multiple lines, then '!end' to finish
Type '!edit' to open your default editor and modify the prompt.
Type '!fragment <my_fragment> [<another_fragment> ...]' to insert one or more fragments
> Tell me a joke about a pelican
Why don't pelicans like to tip waiters?

Because they always have a big bill!

关于本项目的更多背景:

另请参阅我博客上的 llm 标签

目录