ai& CLI
The ai& CLI, aiand, signs you in through your browser and manages your API key for you. It sets up coding agents to run on ai&, sends prompts, and covers the everyday console tasks (model catalog, request logs, usage) from the terminal. It is open source at github.com/aiandlabs/aiand-cli.
npm install -g @aiand/cliaiand code # sign in, set up OpenCode, and open it on ai&aiand run "hello" # or send a single promptInstall
Section titled “Install”The CLI requires Node.js 22 or newer.
npm install -g @aiand/clicurl -fsSL https://raw.githubusercontent.com/aiandlabs/aiand-cli/main/install.sh | bashirm https://raw.githubusercontent.com/aiandlabs/aiand-cli/main/install.ps1 | iexThe install scripts add aiand to your PATH by editing your shell profile. Set AIAND_NO_MODIFY_PATH=1 to skip that change.
Update and uninstall
Section titled “Update and uninstall”To update, run the install command again.
To uninstall, the install script first turns off every coding agent aiand set up, then removes the CLI. Your profiles and credentials under ~/.config/aiand are kept.
aiand init --offnpm uninstall -g @aiand/clibash ~/.aiand/cli/install.sh uninstall& "$env:USERPROFILE\.aiand\cli\install.ps1" uninstallSign in
Section titled “Sign in”aiand loginaiand login opens your browser. Approving the sign-in creates an API key for your organization, named aiand@<hostname> so you can tell machines apart in the console. If browser sign-in can’t finish (no browser, a timeout, or no terminal), the CLI switches to a code you approve from any device:
Your code BCDF-GHJK Approve at https://api.aiand.com/auth/device?user_code=BCDF-GHJKTo use a key you already created in the console instead:
aiand login --paste # masked promptaiand login --with-token < key.txt # read the key from stdinaiand whoami shows the signed-in identity, organization, and key expiry. aiand status adds where the key is stored and which coding agents are set up.
aiand logout offers to revoke a key that aiand login created. A pasted key is only removed from this machine; revoke it in the console.
Where the key is stored
Section titled “Where the key is stored”The key is stored in the OS keychain when one is available, otherwise in an encrypted file under ~/.config/aiand/. The encryption key for that file sits next to it, so it protects against a casual look, not against anyone who can read the directory. Set AIAND_KEY_STORAGE=plaintext to store the key in a plain owner-only file instead.
Keys created by aiand login last 30 days. The CLI rotates them automatically during their last 3 days, or immediately if the API rejects one. Pasted keys are never rotated or revoked by the CLI.
Commands
Section titled “Commands”| Command | What it does |
|---|---|
aiand login / aiand logout | Start or end this machine’s session |
aiand whoami | Identity, organization, and key expiry |
aiand status | Sign-in state and each coding agent’s setup |
aiand code | Open OpenCode on ai&, setting it up first if needed |
aiand <agent> | Open a coding agent on ai& the same way |
aiand <agent> on / off / status | Set up a coding agent to use ai&, remove that setup, or check it |
aiand init | Detect installed coding agents and set them up in one go |
aiand run-agent <agent> | Run a coding agent on ai& for one session, changing no config |
aiand restore <agent> --force | Put an agent’s config back as it was before aiand changed it |
aiand run <prompt> | Send one prompt and stream the answer to stdout |
aiand chat | Interactive conversation |
aiand models | Model catalog, priced in your billing currency |
aiand logs | Recent requests, with --follow to tail new ones |
aiand usage | Requests and tokens, compared with the previous period |
aiand orgs | Organizations you belong to |
aiand config | Profiles and defaults |
aiand key export | Print the active key, for piping into another tool |
Most commands accept --json, and every command accepts --help.
Coding agents
Section titled “Coding agents”The CLI supports three coding agents. <agent> is one of:
| Agent | Command | Guide |
|---|---|---|
| OpenCode | aiand opencode (or aiand code) | OpenCode |
| Claude Code | aiand claude | Claude Code |
| Codex | aiand codex | Codex |
aiand <agent> opens the agent on ai&. If you’re signed out, it signs you in. If the agent isn’t installed, it offers to install it. If the agent isn’t set up for ai& yet, it runs on first, so the agent’s own command uses ai& afterwards too.
aiand claude # open Claude Code on ai&, setting it up first if neededaiand claude on # set up Claude Code to use ai&aiand claude status # check what Claude Code is configured to useaiand claude off # remove only what aiand addedaiand run-agent claude # use ai& for this one session, change nothingaiand init --all # set up every installed agentArguments after the agent name are passed to the agent unchanged, as in aiand claude -p "explain this repo". Put aiand’s own flags before the agent name (aiand --profile work codex), and put -- before an argument aiand would read as a verb (aiand opencode -- status). Pass --model <id> to on to choose the model.
on snapshots the agent’s config before its first change, and off removes only what aiand added. To return to the exact config from before aiand, run aiand restore <agent> --force. What on writes for each agent is described in its guide.
Run prompts
Section titled “Run prompts”aiand run "why is the sky blue?"cat main.ts | aiand run "review this file"aiand run -m deepseek-ai/deepseek-v4-flash --system "be terse" "summarize CAP theorem"aiand run --no-stream --json "hello" | jq .usageaiand chatPiped input is appended to the prompt. The answer goes to stdout and everything else to stderr, so aiand run "..." > out.md saves only the answer. After each answer, a footer shows the model, tokens, cost, time, and request ID; -q hides it.
Without -m, the CLI uses your profile’s model, or the recommended default from the catalog. -m auto lets ai& choose per request where your account supports it; see Automatic Selection. Set a default with aiand config set model <id>.
In aiand chat, type /help to list the in-session commands, such as /model <id> to switch models.
Models, logs, and usage
Section titled “Models, logs, and usage”aiand models --capability vision # filter the catalogaiand logs --range 1h --errors # only failed requestsaiand logs --follow # tail new requestsaiand usage --range 30daysaiand usage --metrics # full breakdownaiand modelslists the catalog with prices per 1M tokens in your billing currency. It also works signed out, priced in USD. Filter with--search,--capability, and--sort.aiand logsreads the request logs.--rangetakes15m,1h,6h,24h(default),7days, or30days.aiand usagesummarizes usage against the previous period.--rangetakes1h,24h,7days(default),30days, or3months.
Logs and usage cover your whole organization, not just this machine.
Organizations and profiles
Section titled “Organizations and profiles”The CLI’s key is scoped to one organization, chosen at sign-in. aiand orgs lists the organizations you belong to. To work in a different organization, change your default organization in the console and run aiand login --force.
Profiles keep separate sign-ins, so each profile can hold a key for a different organization:
aiand login --profile workaiand --profile work usageaiand config use work # make it the default profileSee Switching Orgs for how organizations apply to API requests.
Configuration
Section titled “Configuration”aiand config # current settingsaiand config set model deepseek-ai/deepseek-v4-flashaiand config profiles # list profilesaiand config path # where the files areSettings live in ~/.config/aiand/config.json (or under $XDG_CONFIG_HOME). Credentials are kept in a separate file, so the config file is safe to share. Flags take precedence over environment variables, which take precedence over the stored profile.
| Variable | Effect |
|---|---|
AIAND_API_KEY | Use this key; no sign-in, nothing stored |
AIAND_PROFILE | Profile to use |
AIAND_BASE_URL | API endpoint (default https://api.aiand.com) |
AIAND_AUTH_URL | Sign-in endpoint, if different from the API |
AIAND_CONFIG_DIR | Where config and credentials live |
AIAND_HOME | Home directory to look for agent configs in, such as your Windows home from WSL |
AIAND_KEY_STORAGE | keychain, file, or plaintext |
AIAND_NO_BROWSER=1 | Never open a browser; print the sign-in link instead |
AIAND_UPDATE_CHECK=0 | Turn off the daily update notice |
NO_COLOR | Turn off color |
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | Success |
1 | Request or usage error; the message says which |
2 | Not signed in, or the session could not be refreshed |
3 | Sign-in denied, or the code expired |
70 | A bug in the CLI; the stack trace is printed |
127 | Unknown command, or the coding agent isn’t installed |
130 | Interrupted (Ctrl-C) |
aiand status exits 0 when signed in, even if ai& can’t be reached to check the key, and 1 only when signed out, so scripts that check it keep working during an outage.
Report bugs and request features on GitHub.