Pydantic AI CLI: command line interface to chat to LLMs
Project description
clai
(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-5". Defaults to "openai:gpt-5".
-a AGENT, --agent AGENT
Custom Agent to use, in format "module:variable", e.g. "mymodule.submodule:my_agent"
-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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clai-1.56.0.tar.gz.
File metadata
- Download URL: clai-1.56.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d92a61c4568603240a7f97bff1bff56338c3e58e8dac4a60b04048bf4124cdf9
|
|
| MD5 |
d2936216104bf4d66db95638a308e46b
|
|
| BLAKE2b-256 |
81ac0939f9e7f86f7ac5585054b0db9395fd97e59d45424919111682ccdae6ce
|
Provenance
The following attestation bundles were made for clai-1.56.0.tar.gz:
Publisher:
ci.yml on pydantic/pydantic-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clai-1.56.0.tar.gz -
Subject digest:
d92a61c4568603240a7f97bff1bff56338c3e58e8dac4a60b04048bf4124cdf9 - Sigstore transparency entry: 921575251
- Sigstore integration time:
-
Permalink:
pydantic/pydantic-ai@d398bc9d39aecca6530fa7486a410d5cce936301 -
Branch / Tag:
refs/tags/v1.56.0 - Owner: https://github.com/pydantic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d398bc9d39aecca6530fa7486a410d5cce936301 -
Trigger Event:
push
-
Statement type:
File details
Details for the file clai-1.56.0-py3-none-any.whl.
File metadata
- Download URL: clai-1.56.0-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.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d5e3a361a47683f8ca4dc8f0430232116ee316974dcac7c689c9f1b5565b4f4
|
|
| MD5 |
cc1e50a3bede907a0e8e6461284bc443
|
|
| BLAKE2b-256 |
c506cf5c165239964e61c9248e9e3e134448eab9fbb26bd9118a9189659eef5f
|
Provenance
The following attestation bundles were made for clai-1.56.0-py3-none-any.whl:
Publisher:
ci.yml on pydantic/pydantic-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clai-1.56.0-py3-none-any.whl -
Subject digest:
6d5e3a361a47683f8ca4dc8f0430232116ee316974dcac7c689c9f1b5565b4f4 - Sigstore transparency entry: 921575728
- Sigstore integration time:
-
Permalink:
pydantic/pydantic-ai@d398bc9d39aecca6530fa7486a410d5cce936301 -
Branch / Tag:
refs/tags/v1.56.0 - Owner: https://github.com/pydantic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d398bc9d39aecca6530fa7486a410d5cce936301 -
Trigger Event:
push
-
Statement type: