ai-cli

Installation

Install ai-cli and configure API access.

Install

bash
npm install -g ai-cli

Or with other package managers:

bash
bun add -g ai-cli
pnpm add -g ai-cli
yarn global add ai-cli

API key

ai-cli requires an API key for model access. Set one of the following environment variables:

AI_GATEWAY_API_KEY

string

Vercel AI Gateway key. Provides access to all supported models through a single key.

OPENAI_API_KEY

string

Provider-specific key. Use if you only need OpenAI models.

Get a gateway key from the Vercel AI Gateway dashboard.

bash
export AI_GATEWAY_API_KEY="your-key"

Add this to your shell profile (~/.zshrc, ~/.bashrc, etc.) to persist across sessions.

Verify

bash
ai text "hello"

If you see generated text, you're ready.

Requirements

Bun

1.0+required

ai-cli runs with Bun. Install from bun.sh.

API key

stringrequired

A Vercel AI Gateway key or provider-specific key.