New to Claude Skills? Learn how to install them →

hkuds on GitHub

Ollama CLI Interface

Free

Manage models and generate text from the command line.

by hkuds46.9k stars on hkuds/cli-anything
3 views
Updated Aug 3, 2026
Get this skill

Free · Opens the source repo

What Ollama CLI Interface does

The Ollama CLI Interface provides a powerful command-line tool for managing local LLM (Large Language Model) inference and model management through the Ollama REST API. This skill is specifically designed for AI agents and advanced users who prefer working without a graphical user interface. It allows users to efficiently manage models, generate text, engage in chat interactions, and create embeddings directly from the command line, streamlining workflows for developers and data scientists alike.

Installation is straightforward with a simple pip install command, and it requires Python 3.10 or newer along with a running instance of Ollama. Once set up, users can access a variety of commands grouped by functionality, including model management, text generation, and embedding creation. The CLI also supports interactive REPL mode, enabling users to enter commands directly and utilize tab-completion and command history for a more efficient experience.

For those looking to integrate with AI agents, the CLI outputs can be formatted in both human-readable and machine-readable JSON formats, making it easy to parse the results programmatically. This is particularly useful for automating tasks or building custom workflows where direct interaction with the Ollama models is required. The CLI also maintains session state, tracking the current host URL, chat history, and last used model, which enhances the user experience during extended sessions.

Overall, the Ollama CLI Interface is an essential tool for anyone needing to leverage the capabilities of Ollama models in a command-line environment, making it ideal for developers, data scientists, and AI practitioners who prefer a text-based approach to model management and text generation.

When to use it

Use this tool when you need to manage models or generate text in environments where a GUI is impractical or unavailable.

When not to use it

This skill may not be suitable for users who prefer graphical interfaces or require extensive visual feedback during model management.

What you can build with it

Managing Models

Quickly list, pull, and delete models using simple command-line commands.

Generating Text

Generate text responses or engage in chat interactions with specified models.

Embedding Creation

Create embeddings for text inputs directly from the command line for further analysis.

How to install Ollama CLI Interface

View source

1. Install with the skills CLI

npx skills add hkuds/cli-anything/skills --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by hkuds

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.

CommandDescription
listList locally available models
showShow model details (parameters, template, license)
pullDownload a model from the Ollama library
rmDelete a model from local storage
copyCopy a model to a new name
psList models currently loaded in memory

Generate

Text generation and chat commands.

CommandDescription
textGenerate text from a prompt
chatSend a chat completion request

Embed

Embedding generation commands.

CommandDescription
textGenerate embeddings for text

Server

Server status and info commands.

CommandDescription
statusCheck if Ollama server is running
versionShow Ollama server version

Session

Session state commands.

CommandDescription
statusShow current session state
historyShow 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 (--json flag): 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:

  1. Always use --json flag for parseable output
  2. Check return codes - 0 for success, non-zero for errors
  3. Parse stderr for error messages on failure
  4. Use --no-stream for generate/chat to get complete responses
  5. Verify Ollama is running with server status before 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-plugin

Version

1.0.1

Frequently asked questions about Ollama CLI Interface

Similar skills