How to Install 8 AI Agent CLI for Coding in Terminal

How to Install 8 AI Agent CLI for Coding in Terminal

Bitnesia Development May 22, 2026 81 ID

Ten years ago, developers who worked via the terminal were considered eccentric. Now, the trend has reversed. The AI Agent CLI ecosystem is growing rapidly as large language models (LLMs) mature, becoming capable of reading, writing, and revising code autonomously directly from the command line.

From Anthropic's Claude Code to Moonshot AI's Kimi Code CLI, each tool offers a unique approach to help developers build software faster. You simply describe what you want to do in natural language, and the AI Agent CLI executes it.

What is an AI Agent Command Line Interface (CLI)?

An AI Agent CLI is a terminal program that integrates AI models directly into your shell session. These tools don't just answer questions. They can read files, run commands, perform git commits, write unit tests, and even traverse the entire project structure to understand context before giving recommendations or code changes.

Unlike browser-based chatbots, the AI Agent CLI works inside your project directory. It accesses files directly, so you don't need to repeatedly copy-paste between your editor and a chat interface.

Why Should Developers Use an AI Agent CLI?

  • Speed: No context-switching between browser, editor, and terminal because everything happens in one place.
  • Efficiency: The AI reads the entire project context so suggestions are relevant and don't need repeated explanations.
  • Minimal distractions: No notifications, excess browser tabs, or interfaces that divert focus.
  • Automation: From refactoring to writing documentation, the AI Agent CLI can execute multi-step tasks independently.

Basic Environment Requirements

Before installing any of the tools below, make sure your system has the following components:

  • Node.js 22 or newer: Required by Claude Code, Codex CLI, GitHub Copilot CLI, OpenCode, and Qwen Code. You can download it from nodejs.org.
  • Python 3.12 or newer: Required by Kimi Code CLI.
  • Git: Almost all AI Agent CLIs work optimally inside a git repository.
  • curl or wget: Required to run web-based install scripts.
  • Homebrew (optional, for macOS/Linux): A more practical installation alternative for some tools.

Checking Node.js version:

node --version
# Expected output: v22.x.x or newer

Checking Python version:

python3 --version
# Expected output: Python 3.12.x or newer

Preparing API Keys

Most AI Agent CLIs require an API key from an AI model provider. You need to prepare at least one of the following components before proceeding with installation:

  • Anthropic API Key: Used for Claude Code. You can sign up at console.anthropic.com.
  • OpenAI API Key: Used for Codex CLI. You can sign up at platform.openai.com.
  • GitHub Personal Access Token: Used for GitHub Copilot CLI and requires an active Copilot subscription.
  • Dashscope API Key: Used for Qwen Code. You can sign up at Alibaba Cloud Model Studio.
  • Moonshot API Key: Used for Kimi Code CLI. You can sign up at platform.moonshot.cn.

You can use an API key from any compatible provider for OpenCode CLI. These options include OpenAI, Anthropic, Google Gemini, or local models via Ollama.

Installation Guide for 8 AI Agent CLIs

1. Claude Code

Claude Code is the official AI coding agent from Anthropic, the company that builds the Claude model. This tool is specifically designed to work directly in the terminal, read the entire project context, and execute code changes upon user approval.

Claude Code supports login via a Claude Pro, Max, Team, Enterprise account, or an API key-based Anthropic Console account. This tool is available for macOS, Linux, and Windows via WSL or PowerShell.

Installation on Linux and macOS

The easiest way to install is using the official install script provided by Anthropic:

curl -fsSL https://claude.ai/install.sh | bash

Installation via Homebrew

brew install --cask claude-code

Logging into Your Anthropic Account

After the installation process is complete, run the following command in your project directory. You will be prompted to log in on first launch:

cd /path/to/your/project
claude

Type the following command in the terminal session to log into your account:

/login

Quick Usage Guide

# Interactive mode to open an AI chat in the terminal
claude

# Send a single question and exit the session
claude -p "explain what this function does"

# Resume a previous conversation session
claude -c

Example commands to use within the session:

  • what does this project do?
  • write unit tests for the authentication module
  • commit my changes with a descriptive message

Claude Code always asks for your approval before modifying files. You can enable Accept all mode for a specific session if you want faster execution.

2. Codex CLI

Codex CLI is an open-source coding agent from OpenAI that runs directly in the terminal. This tool has over 84,000 stars on GitHub and is actively developed. Codex CLI can read and write code, run shell commands, and integrate seamlessly into git workflows.

You can use it via a ChatGPT Plus/Pro/Business account without additional API costs, or use a standard OpenAI API key.

Installation via npm (All Platforms)

npm install -g @openai/codex

Installation via Homebrew (macOS/Linux)

brew install --cask codex

Starting Your First Session

cd /path/to/your/project
codex

The first time you run it, Codex CLI will ask you to choose an authentication method. Please select Sign in with ChatGPT if you want to use your ChatGPT subscription, or enter an OpenAI API key if using direct API access.

Configuration via API Key

export OPENAI_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxx"
codex

Quick Usage Guide

# Run the agent interactively
codex

Example prompts within the session:

  • add input validation to the user registration form
  • there's a bug where users can submit empty forms - fix it
  • refactor the authentication module to use async/await
  • write unit tests for the calculator functions

3. Antigravity CLI

Antigravity CLI is a terminal-based AI agent from Google designed for automating DevOps workflows and coding. This tool allows developers to automate repetitive tasks such as build pipelines, deployments, server configuration, and log analysis. These processes are done directly from the command line using natural language instructions.

Antigravity CLI leverages Google's AI models to understand infrastructure and code context holistically. This makes it very suitable for teams working in multi-layered environments between applications and servers.

Installation via Install Script (Linux/macOS)

The most practical way to install this tool is using the official script provided on the Google Antigravity Download site:

curl -fsSL https://antigravity.google/cli/install.sh | bash

Manual Installation via Binary

# Download the binary for your platform from the official releases page
# Then add the binary to your system's PATH
chmod +x antigravity
sudo mv antigravity /usr/local/bin/

Authentication with Google Account

The system will attempt to automatically detect your login session via the operating system's secure keyring. If a session is not found, you can trigger manual authentication with the following command:

antigravity auth login

Note: Please follow the OAuth authentication prompts that appear in your browser window.

Quick Usage Guide

# Start an interactive session inside your project directory
cd /path/to/your/project
antigravity

Examples of DevOps task automation you can request within the terminal session:

  • set up a CI pipeline for this Node.js project
  • analyze the deployment logs and find the error
  • write a Dockerfile for this application
  • create a backup script for the database

4. Cursor CLI

Cursor CLI is the official command-line interface for Cursor Editor, an AI-powered code editor built on the VS Code architecture. This tool allows you to open projects, files, or directories directly from the terminal into Cursor Editor, as well as interact with Cursor's AI features from outside the GUI.

For developers who frequently switch between terminal and editor, Cursor CLI significantly speeds up the workflow by eliminating manual navigation through the graphical interface.

Installing Cursor CLI via Command Palette

The easiest way to install the cursor command in your terminal is through the Command Palette inside Cursor Editor:

  1. Open Cursor Editor.
  2. Press Ctrl+Shift+P (or Cmd+Shift+P on macOS).
  3. Type Shell Command: Install 'cursor' command in PATH.
  4. Press Enter and enter your administrator password if prompted.

Installation on Linux via Manual Symlink

# Adjust the path to match Cursor's installation location on your system
sudo ln -s /opt/cursor/cursor /usr/local/bin/cursor

Quick Usage Guide

# Open the current directory in Cursor Editor
cursor .

# Open a specific file in Cursor
cursor /path/to/file.py

# Open two files at once
cursor file1.js file2.js

# Open Cursor and wait until it's closed (useful for git commit editor)
cursor --wait /path/to/commit-message

Once Cursor is open, you can directly use built-in AI features like inline chat (Ctrl+K), Composer, or Cursor Tab.

5. GitHub Copilot CLI

GitHub Copilot CLI is an official AI tool from GitHub that runs directly in the terminal. This tool does not require GitHub CLI (gh) as a dependency because Copilot CLI is now available as a standalone tool that can be installed independently. You need an active GitHub Copilot subscription, whether Individual, Business, or Enterprise, to use it.

Copilot CLI helps developers craft shell commands, explain complex terminal output, and provide contextual suggestions directly from the command line without opening a browser.

Installation via npm (All Platforms)

Prerequisite: Node.js 22 or newer.

npm install -g @github/copilot

Installation via Homebrew (macOS/Linux)

brew install copilot-cli

Installation via Install Script (macOS/Linux)

curl -fsSL https://gh.io/copilot-install | bash

Authentication

On first launch, Copilot CLI will ask you to log into your account. Please type the /login command and follow the authentication prompts that appear:

copilot

Type the following command in the terminal session:

/login

Authentication via Personal Access Token (Optional)

# Set token as an environment variable
export COPILOT_GITHUB_TOKEN="github_pat_xxxxxxxxxxxxxxxxxx"

Quick Usage Guide

# Run Copilot CLI interactively
copilot

Example requests within the session:

  • suggest a command to find all files modified in the last 7 days
  • explain what this grep command does: grep -rn "pattern" . --include="*.js"
  • help me write a bash script to automate database backups
  • what's the difference between SIGTERM and SIGKILL?

6. OpenCode CLI

OpenCode is an open-source AI coding agent available as a terminal-based TUI (Text User Interface), desktop app, and IDE extension. This tool is developed by Anomaly and is designed so developers can use various LLM providers like OpenAI, Anthropic, Google Gemini, local Ollama, and many more within a single uniform interface.

OpenCode supports Plan mode to plan changes without executing them and Build mode to execute changes directly, as well as undo/redo features for every change made by the AI.

Installation via Install Script (Linux/macOS)

curl -fsSL https://opencode.ai/install | bash

Installation via npm

npm install -g opencode-ai

Installation via Homebrew

brew install anomalyco/tap/opencode

LLM Provider Configuration

After the installation process is complete, run opencode and use the /connect command to connect your chosen AI provider:

opencode

Type the following command in the TUI session:

/connect

Please select a provider like OpenAI, Anthropic, OpenCode Zen, or other options, then enter the requested API key. This configuration will be saved automatically for future sessions.

Initialization in a New Project

cd /path/to/your/project
opencode

Type the following command in the terminal session:

/init

The /init command will create an AGENTS.md file in your project root. This file contains OpenCode's understanding of the project's structure and coding patterns. You should commit this file to git to preserve context across sessions.

Quick Usage Guide

  • /model to change the AI model within a session.
  • Press the Tab key to switch to Plan mode when the AI plans and does not execute.
  • Press the Tab key again to switch to Build mode.
  • /undo to undo the last change.
  • /share to share the session as a link.

7. Qwen Code CLI

Qwen Code is an open-source terminal AI agent optimized for Alibaba's Qwen model. This tool supports multi-protocol like OpenAI, Anthropic, and Gemini-compatible APIs, so it is not locked into a single provider. Qwen Code also supports Ollama and vLLM for running models locally without an internet connection.

This tool is based on the Gemini CLI architecture adapted to optimally support the Qwen-Coder model. The project has over 24,000 stars on GitHub as of May 2026.

Quick Installation via Install Script (Linux/macOS)

bash -c "$(curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh)"

Installation via npm

npm install -g @qwen-code/qwen-code@latest

Installation via Homebrew (macOS/Linux)

brew install qwen-code

API Key Configuration via settings.json

Please create or edit the ~/.qwen/settings.json file with the following configuration. You need to replace DASHSCOPE_API_KEY with your API key from Alibaba Cloud Model Studio:

{
  "modelProviders": {
    "openai": [
      {
        "id": "qwen3.6-plus",
        "name": "qwen3.6-plus",
        "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
        "description": "Qwen3-Coder via Dashscope",
        "envKey": "DASHSCOPE_API_KEY"
      }
    ]
  },
  "env": {
    "DASHSCOPE_API_KEY": "sk-xxxxxxxxxxxxx"
  },
  "security": {
    "auth": {
      "selectedType": "openai"
    }
  },
  "model": {
    "name": "qwen3.6-plus"
  }
}

Configuration via Environment Variable

export DASHSCOPE_API_KEY="sk-xxxxxxxxxxxxx"
qwen

Configuration with Local Model via Ollama

{
  "modelProviders": {
    "openai": [
      {
        "id": "qwen2.5-coder:7b",
        "name": "qwen2.5-coder:7b",
        "baseUrl": "http://localhost:11434/v1",
        "envKey": "OLLAMA_API_KEY"
      }
    ]
  },
  "env": {
    "OLLAMA_API_KEY": "ollama"
  },
  "security": {
    "auth": {
      "selectedType": "openai"
    }
  }
}

Quick Usage Guide

# Run Qwen Code interactively
cd /path/to/your/project
qwen

# Automatic code review
qwen -p "review all files in the src/ folder and find potential bugs"

# Analyze project structure
qwen -p "explain this project's architecture and create a summary"

Example commands within the terminal session:

  • /model to change the model within a session.
  • /auth to view authentication status.

8. Kimi Code CLI

Kimi Code CLI is a terminal AI agent from Moonshot AI that is highlighted for its long context processing capability. This tool is suitable for developers who need to analyze large code files, traverse massive codebases, or work on projects with very long and complex context.

Kimi Code CLI runs on Python and supports three modes. These options include interactive CLI, browser UI (kimi web), and agent integration via Agent Client Protocol (kimi acp) for IDE integration.

Prerequisite: Python 3.12 or Newer

python3 --version
# Make sure the version is 3.12 or above

Installation via Install Script (Linux/macOS)

curl -LsSf https://code.kimi.com/install.sh | bash

Installation via uv (If Already Installed)

uv tool install --python 3.13 kimi-cli

Installation on Windows (PowerShell)

Invoke-RestMethod https://code.kimi.com/install.ps1 | Invoke-Expression

Verify Installation

kimi --version

Login and API Configuration

Run Kimi Code CLI in your project directory, then use the /login command to configure the API source:

cd /path/to/your/project
kimi

Type the following command in the terminal session:

/login

After running /login, please select the desired platform. The Kimi Code option automatically opens a browser for OAuth authorization. Other options require manual API key input.

Manual Moonshot API Key Configuration

export MOONSHOT_API_KEY="sk-xxxxxxxxxxxxxxxxxx"
kimi

Quick Usage Guide

# Interactive mode in project directory
cd /path/to/your/large-project
kimi

Example commands and navigation within the session:

  • /init to initialize AGENTS.md to help the AI understand the project.
  • analyze the entire codebase structure and identify potential performance bottlenecks to analyze large files directly from within the session.
  • kimi web to use the browser interface.
  • /help to see all available commands.
  • uv tool upgrade kimi-cli --no-cache to update to the latest version.

Tips for Choosing the Right AI Agent CLI

  • Already have a Claude Pro or Max subscription? You can use Claude Code directly with no additional API costs and excellent model quality for coding.
  • A ChatGPT Plus/Pro user? Codex CLI is a natural choice because it integrates directly with your ChatGPT subscription.
  • Need multi-provider flexibility? OpenCode CLI and Qwen Code CLI support many providers simultaneously, making them ideal for teams that don't want to be locked into a single vendor.
  • Working with a very large codebase? Kimi Code CLI excels here thanks to its long context window capability.
  • Focused on the Linux terminal and DevOps? Antigravity CLI is specifically designed for automating infrastructure and deployment workflows.
  • A Cursor Editor user? You can enable Cursor CLI to bridge terminal workflow and AI editor within a single ecosystem.
  • Have GitHub Copilot through your organization? GitHub Copilot CLI requires no additional API key configuration and integrates directly with your GitHub account.

Conclusion

AI Agent CLIs are fundamentally changing how developers interact with computers. The terminal, once merely a place to run commands, is now a collaboration space between humans and AI. A space where ideas are translated into code, bugs are found and fixed, and infrastructure is configured. All these processes happen in a single session without leaving the command line.

The eight tools discussed in this article have different characteristics, strengths, and ecosystems. No single tool is perfect for every case. You can choose a tool based on which AI provider you already subscribe to, the size and complexity of your project, and your daily working style.

The best step is to try at least two or three tools from this list. After that, you can evaluate which option best fits your coding rhythm. All the tools above can be installed in minutes, so there's no reason to delay getting started.

Help me create more! Your donations go directly toward better equipment and research for future tutorials.

Support future guides

Related Posts