Skip to main content

Pydantic AI CLI: command line interface to chat to LLMs

Project description

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] [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

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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clai-2.0.0b6.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clai-2.0.0b6-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file clai-2.0.0b6.tar.gz.

File metadata

  • Download URL: clai-2.0.0b6.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for clai-2.0.0b6.tar.gz
Algorithm Hash digest
SHA256 f8b928ccc5b2731db72d6de4ed713b62d98b1ab606a1a7791200789bf81e2a69
MD5 4625f6cd93ada8013d4104f6fdfa94b1
BLAKE2b-256 c75f2f95e43e09e397375dcc38b13ee473bbecea6b919f63d3cf8b339f613a97

See more details on using hashes here.

Provenance

The following attestation bundles were made for clai-2.0.0b6.tar.gz:

Publisher: ci.yml on pydantic/pydantic-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clai-2.0.0b6-py3-none-any.whl.

File metadata

  • Download URL: clai-2.0.0b6-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for clai-2.0.0b6-py3-none-any.whl
Algorithm Hash digest
SHA256 19c4df0fc9779e7a4fa9b8a8b0fd7cba338985b6505815452169fb4506af6219
MD5 2ab37b7b14ff2226578aff01522bbc2b
BLAKE2b-256 4a4430aba13dd3c9f3b61d27be194f731e6f00236ae34240e844ad37b870aaa2

See more details on using hashes here.

Provenance

The following attestation bundles were made for clai-2.0.0b6-py3-none-any.whl:

Publisher: ci.yml on pydantic/pydantic-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page