cli-anything-ollama
它能做什么
这个技能让 AI 智能体通过 Ollama 直接在你自己的电脑上运行 AI 模型。适合希望把文本保留在自己电脑上的人。
适用场景
- ✓当你想让 AI 模型回答问题,同时不把文字发送到在线服务的时候。
- ✓当你需要查看已安装了哪些模型以及它们的设置的时候。
- ✓当你想为搜索或匹配任务创建嵌入的时候。
技能链接
https://github.com/HKUDS/CLI-Anything/blob/main/ollama/agent-harness/cli_anything/ollama/skills/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我让本地的 Ollama 模型总结这些私人会议笔记。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体向你电脑上的 Ollama 服务器发送请求,并取回答案。在该技能工作之前,Ollama 必须已经在运行。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
cli-anything-ollama
Local LLM inference and model management via the Ollama REST API. Designed for AI agents and power users who need to manage models, generate text, chat, and create embeddings without a GUI.
Installation
This CLI is installed as part of the cli-anything-ollama package:
pip install cli-anything-ollama
Prerequisites:
- Python 3.10+
- Ollama must be installed and running (
ollama serve)
Usage
Basic Commands
# Show help
cli-anything-ollama --help
# Start interactive REPL mode
cli-anything-ollama
# List available models
cli-anything-ollama model list
# Run with JSON output (for agent consumption)
cli-anything-ollama --json model list
REPL Mode
When invoked without a subcommand, the CLI enters an interactive REPL session:
cli-anything-ollama
# Enter commands interactively with tab-completion and history
Command Groups
Model
Model management commands.
| Command | Description |
|---|---|
list |
List locally available models |
show |
Show model details (parameters, template, license) |
pull |
Download a model from the Ollama library |
rm |
Delete a model from local storage |
copy |
Copy a model to a new name |
ps |
List models currently loaded in memory |
Generate
Text generation and chat commands.
| Command | Description |
|---|---|
text |
Generate text from a prompt |
chat |
Send a chat completion request |
Embed
Embedding generation commands.
| Command | Description |
|---|---|
text |
Generate embeddings for text |
Server
Server status and info commands.
| Command | Description |
|---|---|
status |
Check if Ollama server is running |
version |
Show Ollama server version |
Session
Session state commands.
| Command | Description |
|---|---|
status |
Show current session state |
history |
Show chat history for current session |
Examples
List and Pull Models
# List available models
cli-anything-ollama model list
# Pull a model
cli-anything-ollama model pull llama3.2
# Show model details
cli-anything-ollama model show llama3.2
Generate Text
# Stream text (default)
cli-anything-ollama generate text --model llama3.2 --prompt "Explain quantum computing in one sentence"
# Non-streaming with JSON output (for agents)
cli-anything-ollama --json generate text --model llama3.2 --prompt "Hello" --no-stream
Chat
# Single-turn chat
cli-anything-ollama generate chat --model llama3.2 --message "user:What is Python?"
# Multi-turn chat
cli-anything-ollama generate chat --model llama3.2 \
--message "user:What is Python?" \
--message "user:How does it compare to JavaScript?"
# Chat from JSON file
cli-anything-ollama generate chat --model llama3.2 --file messages.json
Embeddings
cli-anything-ollama embed text --model nomic-embed-text --input "Hello world"
cli-anything-ollama embed text --model nomic-embed-text --input "Hello" --input "World"
Interactive REPL Session
Start an interactive session for exploratory use.
cli-anything-ollama
# Enter commands interactively
# Use 'help' to see available commands
Connect to Remote Host
cli-anything-ollama --host http://192.168.1.100:11434 model list
State Management
The CLI maintains lightweight session state:
- Current host URL: Configurable via
--host - Chat history: Tracked for multi-turn conversations in REPL
- Last used model: Shown in REPL prompt
Output Formats
All commands support dual output modes:
- Human-readable (default): Tables, colors, formatted text
- Machine-readable (
--jsonflag): Structured JSON for agent consumption
# Human output
cli-anything-ollama model list
# JSON output for agents
cli-anything-ollama --json model list
For AI Agents
When using this CLI programmatically:
- Always use
--jsonflag for parseable output - Check return codes - 0 for success, non-zero for errors
- Parse stderr for error messages on failure
- Use
--no-streamfor generate/chat to get complete responses - Verify Ollama is running with
server statusbefore other commands
More Information
- Full documentation: See README.md in the package
- Test coverage: See TEST.md in the package
- Methodology: See HARNESS.md in the cli-anything
常见问题
我需要让 Ollama 处于运行状态吗?
需要。该技能需要 Ollama 服务器运行,你可以用 ollama serve 命令启动它。
它可以下载新模型吗?
可以。pull 命令可以从 Ollama 模型库下载模型。
它可以显示哪些模型已加载吗?
可以。有一个命令可以列出当前已加载到内存中的模型。
详情
作者的原始描述
Command-line interface for Ollama - Local LLM inference and model management via Ollama REST API. Designed for AI agents and power users who need to manage models, generate text, chat, and create embeddings without a GUI.
repo: HKUDS/CLI-Anything
热度
- GitHub 星标
- 58k
- 排名
- #3234
- 许可证
- Apache-2.0
- 更新时间
- 2026/9/21
评论
- …
同一仓库的更多技能
cli-anything-3mf
58k帮你的智能体检查和修复 3D 打印文件,包括查找圆孔、调整孔径、修复网格,以及比较两个文件。
cli-anything-qgis
58k帮你的智能体在终端中打开、编辑和导出 QGIS 地图项目,包括图层、要素、打印布局和处理工具。
cli-anything-adguardhome
58k帮你的智能体管理 AdGuard Home,这是一款全网络广告拦截器,可管理过滤规则、DNS 重写、客户端和查询日志。
cli-anything-anygen
58k帮你的智能体借助 AnyGen 服务,根据文字提示生成幻灯片、文档、网站和图表。