# CLI

> Complete command and flag reference for the clai binary.

Canonical URL: https://www.clai.chat/docs/v0.1/reference/cli/ · Version: 0.1 · 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`, `continue <id>`, `delete <id>`, `help`).                               |
| `photo <prompt>`      | `p`       | Generate images using the configured photo model.                                                    |
| `video <prompt>`      | `v`       | Generate videos using the configured video model.                                                    |
| `setup [stage]`       | `s`       | Interactive configuration wizard (`0` text, `1` photo, `2` video, `3` profiles, `4` shell contexts). |
| `skills [subcommand]` | `sk`      | List and invoke `SKILL.md` Agent Skills.                                                             |
| `shell_context`       | `sc`      | Inspect or render shell context definitions.                                                         |
| `version`             | `v`       | Print the binary version and exit.                                                                   |
| `help`                | `h`       | Print CLI usage help.                                                                                |

### Account commands

The following `clai.chat` cloud sync account commands are in preview:

- `clai login` — authenticate with `clai.chat` through the browser (`--space`, `--bucket`, `--read-only`, `--site` / `CLAI_SITE`, `--no-browser`, `--force`).
- `clai logout` — revoke and remove the stored login key (`--site` / `CLAI_SITE`).
- `clai space` — list or select the default cloud sync space (`--endpoint` / `CLAI_ENDPOINT`).

## Flags

| Flag              | Long flag            | Description                                                               |
| ----------------- | -------------------- | ------------------------------------------------------------------------- |
| `-cm <model>`     | `-chat-model`        | Override the configured chat model for this invocation.                   |
| `-pm <model>`     | `-photo-model`       | Override the configured photo model.                                      |
| `-vm <model>`     | `-video-model`       | Override the configured video model.                                      |
| `-p <name>`       | `-profile`           | Load `~/.config/clai/profiles/<name>.json`.                               |
| `-pr-path <path>` | `-profile-path`      | Load a profile JSON file from an explicit path.                           |
| `-t [glob]`       | `-tools`             | Enable tools (all tools when bare, or filtered by comma-separated globs). |
| `-i`              | `-replace`           | Replace `{}` in the prompt with piped `stdin`.                            |
| `-I <str>`        | `-replace-string`    | Replace `<str>` in the prompt with piped `stdin`.                         |
| `-r`              | `-reply`             | Prepend the previous reply as context to this query.                      |
| `-c`              | `-continue`          | Continue the last active conversation thread.                             |
| `-cg`             | `-chat-global-scope` | Use global conversation scope instead of directory-scoped chat.           |
| `-re`             | `-raw`               | Print raw output without terminal Markdown formatting.                    |
| `-sc <name>`      | `-shell-context`     | Inject the named shell context from `shellContexts/<name>.json`.          |
