The ant CLI is Anthropic's official command-line interface to the Claude API. Every API resource is exposed as a subcommand, with built-in output formatting, response filtering, and YAML or JSON file input. For developers, it fills the gap between "open the SDK docs and write a script" and "hand-assemble a curl command": you can send a message, inspect a resource, or wire an API call into a shell pipeline in one line. It is a developer and operations tool for the Claude API surface — application code should still use the SDKs.
Installing
On macOS, install through Homebrew:
brew install anthropics/tap/ant
On Linux and WSL, download the release tarball from github.com/anthropics/anthropic-cli/releases and extract the binary onto your PATH — the official docs show a one-liner of the form curl -fsSL ".../v${VERSION}/ant_${VERSION}_${OS}_${ARCH}.tar.gz" | sudo tar -xz -C /usr/local/bin ant. If you have a Go toolchain (Go 1.22+), go install github.com/anthropics/anthropic-cli/cmd/ant@latest builds from source and drops the binary in $(go env GOPATH)/bin.
Verify with ant --version, and set up shell completion for bash, zsh, fish, or PowerShell with ant @completion <shell>. On macOS, if the binary is quarantined after install, clear it with xattr -d com.apple.quarantine "$(brew --prefix)/bin/ant".
The command shape
Commands follow one consistent pattern:
ant <resource>[:<subresource>] <action> [flags]
ant --help lists the resources, and --help on any subcommand shows its flags. A first request looks like this:
ant messages create \
--model claude-opus-4-8 \
--max-tokens 1024 \
--message '{role: user, content: "Hello, Claude"}'
The response is the full API object, pretty-printed when stdout is a terminal. Note the relaxed YAML in --message — structured flags accept relaxed YAML or strict JSON, so you rarely fight quoting. Beta resources (agents, sessions, environments, deployments, skills, vaults, memory stores) live under a beta: prefix, such as ant beta:agents retrieve --agent-id ..., and the CLI automatically sends the right anthropic-beta header for them.
Authentication deserves its own article, but the short version: ant auth login opens a browser-based OAuth flow against the Claude Console and stores credentials locally, so you can make that first request without ever creating or managing an API key. If you already have a key, exporting ANTHROPIC_API_KEY works too — the CLI resolves credentials in the same order as the SDKs.
Why it beats curl for API work
Four conveniences do most of the heavy lifting. Request bodies are built from typed flags or piped YAML instead of hand-escaped JSON. @path references inline file contents into any string field. A built-in --transform flag extracts fields from responses using GJSON path syntax, so you don't need jq in the pipeline. And list endpoints paginate automatically. Global flags round it out: --format selects output (auto, json, jsonl, yaml, pretty, raw, explore), and --debug dumps the full HTTP request and response to stderr with the API key redacted — invaluable when something misbehaves.
ant; drive sessions and events from application code with an SDK. The CLI is also the fastest way to poke at a new API feature before committing to code.One scope note for 3P readers
The ant CLI targets the Claude API from Anthropic. If your organization consumes Claude through Amazon Bedrock, Google Vertex AI, or Microsoft Foundry, day-to-day resource management happens through that cloud's own console and CLI tooling instead — check the official documentation for your platform. The ant workflows in this series assume a Claude API credential.
Where to go next
Get credentials wired up in Authenticating the ant CLI, then see scripting with the ant CLI for pipelines and Makefiles, and listing and switching models for development workflows. The quickstart covers first calls on every platform.