Skip to main content

clai

CI Coverage PyPI versions license

(pronounced "clay")

Command line interface to chat to LLMs, part of the Pydantic AI project.

Usage

You'll need to set an environment variable depending on the provider you intend to use.

E.g. if you're using OpenAI, set the OPENAI_API_KEY environment variable:

export OPENAI_API_KEY='your-api-key-here'

Then with uvx, run:

uvx clai

Or to install clai globally with uv, run:

uv tool install clai
...
clai

Or with pip, run:

pip install clai
...
clai

Either way, running clai will start an interactive session where you can chat with the AI model. Special commands available in interactive mode:

  • /exit: Exit the session
  • /markdown: Show the last response in markdown format
  • /multiline: Toggle multiline input mode (use Ctrl+D to submit)
  • /cp: Copy the last response to clipboard

Help

usage: clai [-h] [-l] [--version] [-m MODEL] [-a AGENT] [-t CODE_THEME] [--no-stream] [--mcp-config MCP_CONFIG] [prompt]

Pydantic AI CLI v...

subcommands:
  web           Start a web-based chat interface for an agent
                Run "clai web --help" for more information

positional arguments:
  prompt                AI prompt for one-shot mode. If omitted, starts interactive mode.

options:
  -h, --help            show this help message and exit
  -l, --list-models     List all available models and exit
  --version             Show version and exit
  -m MODEL, --model MODEL
                        Model to use, in format "<provider>:<model>" e.g. "openai:gpt-5" or "anthropic:claude-sonnet-4-6". Defaults to "openai:gpt-5".
  -a AGENT, --agent AGENT
                        Custom Agent to use: a module path like "module:variable" or a YAML/JSON spec file like "agent.yml"
  -t CODE_THEME, --code-theme CODE_THEME
                        Which colors to use for code, can be "dark", "light" or any theme from pygments.org/styles/. Defaults to "dark" which works well on dark terminals.
  --no-stream           Disable streaming from the model
  --mcp-config MCP_CONFIG
                        Path to MCP servers configuration file (JSON, using the same mcpServers shape as Claude Desktop, Claude Code, and Cursor).

For more information on how to use it, see the CLI documentation.

Web Chat UI

Launch a web-based chat interface:

clai web -m openai:gpt-5.2

Web Chat UI

This will start a web server (default: http://127.0.0.1:7932) with a chat interface.

You can also serve an existing agent. For example, if you have an agent defined in my_agent.py:

from pydantic_ai import Agent

my_agent = Agent('openai:gpt-5.2', instructions='You are a helpful assistant.')

Launch the web UI with:

clai web --agent my_agent:my_agent

For full Web UI documentation, see Web Chat UI.

Metadata

Release files for mpfaffenberger-clai 2.43.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mpfaffenberger-clai 2.43.0
File Size Uploaded
mpfaffenberger_clai-2.43.0.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mpfaffenberger-clai 2.43.0
File Interpreter ABI Platform
mpfaffenberger_clai-2.43.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / mpfaffenberger_clai-2.43.0.tar.gz

Download URL mpfaffenberger_clai-2.43.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6aa7fd7d07d2cc8875d920d6cfc2533e1036fd74020590e1d34ede32063375ba
BLAKE2b-256 checksum
How to use checksums
3add3a8860b38b680f2d4fc29b747a4eee5b36ce874d4cfc92b452b119d8afcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mpfaffenberger_clai-2.43.0-py3-none-any.whl

Download URL mpfaffenberger_clai-2.43.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a51124a0118047ed75f3fb9fe326c569b19f400a7069064fa48650e1339fe62
BLAKE2b-256 checksum
How to use checksums
be718783d76f5cea1ea49f886d2d54f504dcd65adced367cfe432e8bbd9e9a3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

2.43.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page