Start
Quickstart
Install clai, configure your first model vendor, run terminal queries, and manage chats.
On this page
Get clai running in your terminal in under two minutes.
1. Install clai
Install the latest binary with Go (or see Installation for Nix and source builds):
go install github.com/baalimago/clai@latest
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):
export ANTHROPIC_API_KEY="sk-ant-..."
Run clai setup to select your default chat model, or pass -cm on any command.
3. Run your first query
Ask a question directly from the command line with clai q:
clai q "Write a jq filter that extracts all failing test names"
Pipe stdin and use -i to replace {} with the piped input:
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:
clai -t q "Check why the latest git commit changed internal/cli/cli.go"
Use -r to include the previous reply as context, or -c to continue the most recent conversation thread:
clai -c q "Now write a table-driven unit test for that case"