anthropics/anthropic-cli

The CLI for the Claude API

ant – the official Claude Platform CLI

What it is

  • ant is a command‑line client for Anthropic’s Claude Platform. It lets you call the Claude API directly from your terminal – send chat messages, manage agents, sessions, files, and any other endpoint the platform offers.

Why it matters

  • Provides a lightweight, scriptable way to integrate Claude into local workflows, CI pipelines, or automation scripts without writing code against the raw HTTP API.
  • Mirrors the full feature set of the platform (agents, skills, environments, vaults, deployments, etc.) so you can treat AI resources as code.

Installation

  • Homebrew (macOS/Linux): brew install anthropics/tap/ant
  • Go: go install github.com/anthropics/anthropic-cli/cmd/ant@latest (requires Go 1.22+). The binary lands in $(go env GOPATH)/bin.

Getting started

  1. Authenticate with your Claude Console account: ant auth login or set ANTHROPIC_API_KEY.
  2. Send a quick message:
    ant messages create \
      --model claude-opus-5-5 \
      --max-tokens 1024 \
      --message '{role: user, content: "Hello, Claude"}'
    
  3. For Google‑Cloud‑hosted workspaces, log in with gcloud auth application-default login and export the required ANTHROPIC_GOOGLE_CLOUD_* variables.

Core command style

  • Resources are addressed as ant <resource>[:<subresource>] <command> [flags].
  • Examples:
    • ant models list – list available Claude models.
    • ant messages create … – create a chat completion.
    • ant beta:agents list – list beta‑stage agents.
    • ant apply … – reconcile local files with remote resources (see below).

Managing agents and other resources as code

  • ant apply reads a directory tree of Markdown (agents, deployments) and YAML (environments, vaults, skill definitions) files, then creates/updates the corresponding objects on Claude.
  • A lockfile (claude‑lock.json) records the remote IDs and version hashes, enabling repeatable deployments and safe CI runs.
  • Files reference each other by path instead of raw IDs, making the configuration portable and version‑controlled.
  • Flags like --dry-run, --prune, --force, and --upgrade give fine‑grained control over what changes are applied.

CI integration

  • The README includes a GitHub Actions workflow that runs ant apply on every push to main, using workload‑identity federation to avoid storing API keys. After a successful apply it commits the updated lockfile.

Supported platforms

  • macOS, Linux, Windows (any OS that can run a Go binary).

License

  • MIT.

Bottom line ant turns Claude’s powerful LLM and agent capabilities into a first‑class developer tool, letting you script, automate, and version‑control AI resources just like any other infrastructure.

Related

  • Project
  • Project
  • Project
  • Project
  • Project