If you have Rust installed, you can install gai directly from the repository:
cargo install --git https://github.com/nuttycream/gai
Don't have Rust installed? Download a pre-built binary for your platform:
After downloading, make the binary executable and move it to your PATH:
# Linux
chmod +x gai
sudo mv gai /usr/local/bin/
# or to a local user directory
mkdir -p ~/.local/bin
mv gai ~/.local/bin/
# verify installation
gai --version
For contributors or those who want to build from source:
git clone https://github.com/nuttycream/gai.git
cd gai
cargo build --release
The project includes a flake.nix and .envrc that automatically sets up a
known working development environment using
direnv.
After installation, set up your API keys for your preferred AI provider:
# For Gemini (default provider in config)
export GEMINI_API_KEY="your_api_key_here"
# For OpenAI
export OPENAI_API_KEY="your_api_key_here"
# For Claude
export ANTHROPIC_API_KEY="your_api_key_here"
Add these to your shell profile (~/.bashrc, ~/.zshrc, etc.) to make them
permanent.
Alternatively, use the Gai provider which offers free requests:
gai auth login