# Quickstart

> Install clai with Go, Nix or from source, set a vendor key, run your first queries, and continue a conversation.

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

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

Get `clai` running in your terminal in under two minutes. It is one static
Go binary with no runtime dependencies.

## 1. Install clai

With a Go toolchain, install the latest release:

```sh
go install github.com/baalimago/clai@latest
```

Make sure `$(go env GOPATH)/bin` is on your `PATH`, then check it runs:

```sh
clai version
```

With Nix, install it into your profile instead:

```sh
nix profile install github:baalimago/clai
```

Or build it from source:

```sh
git clone https://github.com/baalimago/clai.git
cd clai
go install .
```

## 2. Export a vendor API key

Set the API key for your preferred model provider (for example `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or `GEMINI_API_KEY`):

```sh
export ANTHROPIC_API_KEY="sk-ant-..."
```

Run `clai setup` to select your default chat model, or pass `-cm` on any
command. On its first run `clai` creates its config directory at
`<os.UserConfigDir()>/.clai` (typically `~/.config/.clai` on Linux and
`~/Library/Application Support/.clai` on macOS); set `CLAI_CONFIG_DIR` to
put it elsewhere. [Configuration](/docs/reference/configuration/) lists
every file in it.

## 3. Run your first query

Ask a question directly from the command line with `clai q`:

```sh
clai q "Write a jq filter that extracts all failing test names"
```

Pipe `stdin` and use `-i` to replace `{}` with the piped input:

```sh
git diff | clai -i q "Summarize this diff in three bullet points: {}"
```

## 4. Enable tools and continue conversations

Pass `-t '*'` to let the model use builtin tools (`bash`, `rg`, `file_tree`, `web_search`) and configured MCP servers:

```sh
clai -t '*' q "Check why the latest git commit changed internal/cli/cli.go"
```

Use `-re` (`-reply`) to reply to the previous query, or `-dre` (`-dir-reply`) to continue the conversation bound to your current working directory:

```sh
clai -re q "Now write a table-driven unit test for that case"
clai -dre q "And add a benchmark for the hot path"
```

## Where to go next

- [Queries and unix pipes](/docs/guides/queries-and-pipes/)
- [Chats and multi-vendor import](/docs/guides/chats-and-vendors/)
- [Profiles and setup](/docs/guides/profiles/)
- [MCP servers and builtin tools](/docs/guides/mcp-and-tools/)
