# CLI

> Complete command and flag reference for the clai binary.

Canonical URL: https://www.clai.chat/docs/reference/cli/ · Version: 1.0 · Updated: 2026-10-21

Full site index: https://www.clai.chat/llms.txt

`clai` takes flags followed by a command (or shorthand) and prompt arguments:

```text
clai [flags] <command> [prompt...]
```

## Commands

| Command                     | Shorthand  | Summary                                                                                                             |
| --------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------- |
| `query <prompt>`            | `q`        | Run a one-shot chat completion with optional `stdin`.                                                               |
| `chat <subcommand>`         | `c`        | Manage conversations (`list\|l`, `continue\|c <id>`, `delete\|d <id>`, `dir`, `dirv2`, `summarize\|s`, `help`).     |
| `replay` / `dir-replay`     | `re`/`dre` | Print the most recent reply from `globalScope.json` (`re`) or the directory-scoped conversation (`dre`).            |
| `photo <prompt>`            | `p`        | Generate images using the configured photo model.                                                                   |
| `video <prompt>`            | `v`        | Generate videos using the configured video model.                                                                   |
| `audio transcribe <file>`   | `a t`      | Transcribe an audio file or `stdin` (`-`) to text.                                                                  |
| `tools [list\|<tool-name>]` | `t`        | List available builtin and cached MCP tools, or print one tool's JSON schema specification.                         |
| `mcp auth <server>`         | —          | Run the interactive OAuth 2.1 flow for a URL-based MCP server.                                                      |
| `profiles [list]`           | —          | List configured profiles under `<config-dir>/profiles`.                                                             |
| `confdir [subpath...]`      | —          | Print the `clai` config directory or a registered subpath within it.                                                |
| `setup [stage...]`          | `s`        | Interactive configuration wizard (`0` general, `1` model files, `2` profiles, `3` MCP servers, `4` shell contexts). |
| `version`                   | —          | Print the binary version and build information.                                                                     |

### Cloud account

The hosted service at clai.chat is not part of the binary: an account exists
only to publish a config on the [community hub](/hub/) and to rate other
people's. Nothing syncs and no key is minted, so you copy a downloaded config
into your own config directory.

## Flags

| Flag                                 | Long flag                                       | Description                                                                        |
| ------------------------------------ | ----------------------------------------------- | ---------------------------------------------------------------------------------- |
| `-r`                                 | `-raw`                                          | Print raw output without `glow` Markdown formatting.                               |
| `-re`                                | `-reply`                                        | Reply to the previous query (use `globalScope.json` as context).                   |
| `-dre`                               | `-dir-reply`                                    | Reply to the directory-scoped conversation bound to the current working directory. |
| `-i`                                 | —                                               | Replace `{}` in the prompt with piped `stdin`.                                     |
| `-I <str>`                           | `-replace`                                      | Replace `<str>` in the prompt with piped `stdin`.                                  |
| `-cm <model>`                        | `-chat-model`                                   | Override the configured chat model for this invocation.                            |
| `-t <spec>`                          | `-tools`                                        | Enable tools (`*` for all tools, or comma-separated tool names/globs).             |
| `-cmd-ban <list>`                    | —                                               | Append comma-separated command ban entries for this run (e.g. `rm,sudo`).          |
| `-lb`                                | `-lookback`                                     | Enable conversation lookback memory and search/inspect/read tools.                 |
| `-mt <n>`                            | `-max-tokens`                                   | Set max context tokens for this run (`0` = unlimited; accepts `300k`, `1.5M`).     |
| `-mtc <n>`                           | `-max-tool-calls`                               | Set max tool calls for this run (`0` = unlimited).                                 |
| `-g <pattern>`                       | `-glob`                                         | Glob files into the query context (e.g. `-g '*.go'`).                              |
| `-p <name>`                          | `-profile`                                      | Load `<config-dir>/profiles/<name>.json`.                                          |
| `-prp <path>`                        | `-profile-path`                                 | Load a profile JSON file from an explicit path.                                    |
| `-s <spec>`                          | `-skills`                                       | Enable Agent Skills (`*` to enable, `none` to disable for this run).               |
| `-asc <name>`                        | `-add-shell-context`                            | Auto-append the named shell context from `shellContexts/<name>.json`.              |
| `-rf <path>`                         | `-response-format`                              | Block streaming and print only the final structured JSON response.                 |
| `-summarize`                         | —                                               | Generate a title and summary for a new conversation alongside the query.           |
| `-sm <model>`                        | `-summary-model`                                | Set the model the conversation summarizer uses.                                    |
| `-n`                                 | `-non-interactive`                              | Disable interactive `stdin` fallback after macro inputs.                           |
| `-pm` / `-pd` / `-pp`                | `-photo-model` / `-photo-dir` / `-photo-prefix` | Override photo model, output directory, or filename prefix.                        |
| `-vm` / `-vd` / `-vp`                | `-video-model` / `-video-dir` / `-video-prefix` | Override video model, output directory, or filename prefix.                        |
| `-am` / `-af`                        | `-audio-model` / `-audio-format`                | Override audio transcription model or output format (`vtt\|srt\|text\|json`).      |
| `-max-tool-calls-after-handover <n>` | —                                               | Set the max tool calls after a context handover (`0` = unlimited).                 |
| `-force`                             | —                                               | `chat summarize`: regenerate a title that already exists.                          |
| `-y`                                 | `-yes`                                          | `chat summarize`: skip the confirmation prompt.                                    |
| `-workers <n>`                       | —                                               | `chat summarize`: number of conversations summarized at once.                      |
| `-parallelism <n>`                   | —                                               | `audio transcribe`: max parallel requests for a split file.                        |
| `-max-request-bytes <n>`             | —                                               | `audio transcribe`: per-request upload cap.                                        |
| `-max-request-seconds <n>`           | —                                               | `audio transcribe`: per-request duration cap.                                      |
| `-max-speakers <n>`                  | —                                               | `audio transcribe`: cap on speaker identities.                                     |
| `-strict-speakers`                   | —                                               | `audio transcribe`: fail instead of rendering unknown speakers.                    |
