← 返回 CLI 目录 抓取的
Ollama
$ ollama 官方出品 中风险 Ollama · AI 能力与音视频 · MIT · macos / linux / windows
ollama 可在 macOS、Linux 与 Windows 上拉取、管理和运行量化后的本地大语言模型。直接运行 ollama run 不带提示词会进入交互式 REPL,而传入提示词参数或配合 list/ps/show 及 localhost:11434 REST API 可顺畅接入脚本。
FCRS-1.0 综合评分
83 /100
良好 (Good)
高置信度 (实测)
零摩擦安装命令
brew install ollama CLI vs MCP 选型建议 仅 CLI 可用
直接使用 ollama list/ps/pull 管理本地模型;需要严格 JSON 推理时,配合 curl 调用 http://localhost:11434/api/generate 即可。
Agent 友好度体检单
本地探针实测证据 ✓ 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
实测版本
Warning: could not connect to a running Ollama instance
冷启动耗时
82 ms
退出码 (help / 非法参数)
0 / 1
NO_COLOR 无色码污染 / 无 TTY 不挂起
Yes / Safe
抓取的 --help 摘要
Large language model runner
Usage:
ollama [flags]
ollama [command]
Available Commands:
serve Start Ollama
create Create a model
show Show information for a model
run Run a model
stop Stop a running model
pull Pull a model from a registry
push Push a model to a registry
signin Sign in to ollama.com
signout Sign out from ollama.com
list List models
ps List running models
cp Copy a model
rm Remove a model
launch Launch the Ollama menu or an integration
help Help about any command
Flags:
-h, --help help for ollama
--nowordwrap Don't wrap words to the next line automatically
--verbose Show timings for response
-v, --version Show version information
Use "ollama [command] --help" for more information about a command. FCRS-1.0 六维评分拆解
Agent 友好度 19 / 25
支持单次 ollama run <model> <prompt> --format json 及 list/ps,但裸跑 ollama run 会进入阻塞 REPL,且 list/ps 仅输出文本表格。
- Supports
--format jsononrun;listandpsemit human tables
安全与权限边界 21 / 25
本地推理确保提示词不离开设备;pull 会向 ~/.ollama/models 写入数 GB 模型权重。
- Local model execution;
pulldownloads multi-GB weights to disk
安装与运行摩擦 13 / 15
可通过 brew 或安装包在全平台安装,但依赖后台 ollama serve 守护进程与充足硬件内存/显存。
- Cross-platform binary/app; requires local
ollama servedaemon and GPU/RAM
能力覆盖与边际价值 13 / 15
本地大模型管理与 OpenAI/Ollama 兼容本地服务生态的事实标准。
- One-command model pulling, quantization management, and local REST API
维护与来源背书 9 / 10
Ollama 官方项目(ollama/ollama),MIT 协议。
- Official
ollama/ollamarepository
文档与可验证性 8 / 10
docs/cli.md 与 ollama --help 清晰易查。
- Official CLI docs at github.com/ollama/ollama
安全边界、鉴权与放权指南
鉴权方式
无需鉴权 本地配置文件
凭证存储位置
在 ~/.ollama/id_ed25519 保存用于向 ollama.com 推送模型的密钥;纯本地推理无需认证。
潜在副作用
只读查询 本地写入 远端写入
费用与配额提示
免费开源(MIT 协议)本地推理运行时;需消耗本地内存/显存与磁盘空间。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Ollama Agent Rules - Never run `ollama run <model>` without a prompt argument or piped stdin—bare invocations enter an interactive chat REPL. - Confirm disk/VRAM capacity before running `ollama pull`, as model weights span several gigabytes.
Agent 高频安全命令配方
只读查询(安全推荐)
列出本地已下载的模型与体积
ollama list
查看本地已安装模型名称、ID、磁盘占用与更新时间。
查看当前已加载至内存的模型
ollama ps
展示驻留在内存/显存中的模型及处理器分配情况。
受控写入与预演
执行单次非交互本地推理
ollama run llama3.2 --format json 'Return {"status":"ok"} as JSON.' 传入提示词参数并指定 --format json,避免进入交互式 REPL。
核心优势
- + 拉取、查看(
list、ps)与运行本地大模型最简便的 CLI。 - +
ollama run <model> <prompt> --format json支持不进入 REPL 直接单次输出 JSON。
注意事项与踩坑点
- !
ollama list与ollama ps不直接输出 JSON(如需 JSON 请请求curl localhost:11434/api/tags)。 - ! 不带提示词的
ollama run <model>会卡在交互对话中,且ollama pull动辄下载数 GB。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI