Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Quick Start

Get up and running with zo in 5 minutes.

:::info Already have OpenAI, Anthropic, or Google API keys? You can use OpenRouter's BYOK (Bring Your Own Key) feature to route requests through your existing accounts. Visit https://openrouter.ai/settings/keys to add your provider keys and get billed directly by your providers instead of through OpenRouter. :::

Basic Usage

Simple Query

zo 'What is Rust?'

This sends a query to the default model (sonnet - Claude Sonnet) and streams the response in real-time.

With Model Selection

# Use Claude Sonnet
zo /sonnet 'Explain async/await in Rust'
 
# Use GPT-4
zo /gpt4 'Write a poem about programming'
 
# Use fuzzy matching
zo /son 'test'  # Matches 'sonnet'

Using CLI Flag

zo --model opus 'Complex reasoning task'

File References

Include file contents using @filename syntax:

# Single file
zo @code.rs 'Review this code for bugs'
 
# Multiple files
zo @v1.py @v2.py 'What are the differences?'
 
# With model selection
zo /sonnet @main.rs 'Add error handling'

File Output

Let AI write files directly using !filename syntax:

# Create a new file
zo 'Write a Python hello world in !hello.py'
 
# Update existing file (read + write)
zo 'Add error handling to @!main.rs'
 
# Generate tests from implementation
zo @app.py 'Generate unit tests in !test_app.py'
 
# Auto-approve changes (skip confirmation)
zo --yes 'Add type hints to @!script.py'

zo shows a colored diff and asks for approval before writing. Use @!file when the AI needs to see existing content before modifying it.

STDIN Pipelines

Pipe command output for AI analysis:

# Git diff analysis
git diff | zo 'Summarize these changes'
 
# Error diagnosis
cargo build 2>&1 | zo /sonnet 'Explain these errors'
 
# Log analysis
tail -n 100 error.log | zo 'Find patterns'
 
# System diagnostics
ps aux | zo 'Which processes use too much memory?'

Chat Mode

Have multi-turn conversations:

zo --chat 'Let us discuss Rust lifetimes'
> Can you give me an example?
> What happens if I violate the rules?
> exit

Chat with Initial Context

# Start with file context
zo --chat @code.rs 'Let us refactor this'
 
# Start with piped input
git diff | zo --chat 'Let us review these changes'

Debug Mode

Inspect the request before sending:

zo --debug /sonnet 'Test prompt'
# Model: sonnet (anthropic/claude-sonnet-4.5)
# Prompt: Test prompt
# Send request? [y/N]

Configuration

Initialize Config

zo +init-config

This creates ~/.config/zo/config.toml with examples and comments.

Set Default Model

# ~/.config/zo/config.toml
default_model = "sonnet"

Now zo 'query' uses Sonnet instead of Flash.

Create Custom Model

[[custom_models]]
name = "coder"
model = "anthropic/claude-sonnet-4.5"
system_prompt = "You are an expert programmer. Provide concise, well-commented code."
zo /coder 'Implement a binary search tree'

Common Workflows

Code Review

# Review current changes
git diff | zo /sonnet 'Review for bugs and best practices'
 
# Review specific file
zo @src/main.rs 'Code review'
 
# Review PR
git diff main...feature | zo /reviewer 'Review this PR'

Error Debugging

# Build errors
cargo build 2>&1 | zo 'Explain and fix'
 
# Test failures
npm test 2>&1 | zo 'Why are these tests failing?'
 
# Runtime errors
cat error.log | zo /debugger 'Root cause analysis'

Documentation

# Generate docs
zo @lib.rs 'Generate API documentation'
 
# Explain code
zo @complex.c 'Explain this line by line'
 
# README generation
zo @*.rs 'Create README with examples'

Data Analysis

# CSV analysis
cat data.csv | zo 'Calculate statistics'
 
# JSON processing
curl -s api.example.com | zo 'Extract emails'
 
# SQL generation
zo @schema.sql 'Query top 10 customers by revenue'

File Generation

# Generate from scratch
zo 'Create a REST API in !server.py with health and users endpoints'
 
# Transform code
zo @old_api.js 'Convert to TypeScript in !api.ts'
 
# Generate from build errors
cargo build 2>&1 | zo 'Fix errors in @!src/lib.rs'
 
# Multi-file generation
zo 'Create !Cargo.toml and !src/main.rs for a CLI that counts words'

Learning

# Concept explanation
zo 'Explain TCP congestion control'
 
# Code examples
zo /teacher 'Explain Rust ownership with examples'
 
# Command help
man grep | zo 'Explain useful grep options'

Shell Integration

Add to ~/.bashrc or ~/.zshrc:

# Explain command
explain() {
    echo "$*" | zo 'Explain this command'
}
 
# Get command suggestions
howto() {
    zo 'How do I $* in bash?'
}
 
# Analyze errors
fix() {
    "$@" 2>&1 | zo 'Why did this fail?'
}
 
# Aliases
alias chat='zo --chat'
alias review='zo /reviewer'

Usage:

explain tar -xzf file.tar.gz
howto find all python files modified today
fix cargo build

Actions

List Models

zo +list-models
# sonnet -> anthropic/claude-sonnet-4.5
# opus -> anthropic/claude-opus-4.5
# flash -> google/gemini-2.5-flash
# ...

Initialize Config

zo +init-config
# Creates ~/.config/zo/config.toml

Tips & Tricks

Model Selection Priority

  1. CLI --model flag (highest)
  2. Slash command in prompt (/sonnet)
  3. default_model from config
  4. Hardcoded fallback: sonnet

Fuzzy Matching

  • Exact match: /sonnetsonnet
  • Substring: /progeminipro
  • Fuzzy: /sonsonnet

Combining Features

# All features together
cat data.csv | zo --debug /sonnet @schema.sql 'Analyze this data'
# STDIN + debug + model + file + prompt

Chat Exit Commands

  • exit
  • quit
  • q
  • Ctrl+D

API Key Sources

  1. OPENROUTER_API_KEY environment variable
  2. api_key in config file

Next Steps