← Documentation

CLI Tool

Command-line interface for terminal workflows, scripts, and CI/CD pipelines.

Installation

macOS and Linux

curl -fsSL https://iri-ai.com/install.sh | sh

Installs to ~/.local/bin

Windows (PowerShell)

irm https://iri-ai.com/install.ps1 | iex

Run as Administrator

npm

npm install -g @iri-ai/cli

Requires Node.js 18+

Verify installation: iri --version

Authentication

Connect the CLI to your iri AI account:

  1. Run iri login
  2. A browser window opens for authentication
  3. Sign in to your iri AI account
  4. The browser redirects back and you're logged in
$ iri login
Opening browser for authentication...
Waiting for authorization...
Successfully logged in as username

SSH/Headless Environments

For SSH or headless environments, copy the URL shown and open it in a browser. After signing in, copy the token displayed and paste it in the terminal.

Commands

iri loginConnect to your iri AI account
iri logoutDisconnect from iri AI
iri statusCheck login status and current organization
iri orgsList your organizations
iri orgs switch [name]Switch to a different organization
iri savingsView cost savings summary
iri cache clearClear the local response cache
iri proxy startStart the local optimization proxy
iri proxy stopStop the proxy

Integration Examples

Start the local proxy and configure your AI tools to use it:

Claude Code

iri proxy start
export ANTHROPIC_BASE_URL=http://localhost:9876/v1

OpenAI Python

import openai
client = openai.OpenAI(
base_url="http://localhost:9876/v1"
)

cURL

curl http://localhost:9876/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{"model": "gpt-4", "messages": [...]}'

Environment Variables

IRI_API_URLOverride the iri AI server URL
IRI_PROXY_PORTDefault proxy port (default: 9876)
IRI_CONFIG_DIRConfig directory (default: ~/.config/iri-ai)
IRI_NO_COLORDisable colored output

Troubleshooting

Command not found: iri

Add ~/.local/bin to your PATH. Restart terminal or run: source ~/.bashrc

Login times out

Ensure browser can reach iri-ai.com. If browser didn't open, manually visit the URL shown.

Port already in use

Another process is using port 9876. Use: iri proxy start --port 9877

How to update

Run the install command again, or: npm update -g @iri-ai/cli

Next Steps