# Anthropic CLI (ant)
`ant` is [[Anthropic]]'s official CLI for the [[Claude Platform]]. It shipped in April 2026 alongside [[Claude Managed Agents]], and on **2 June 2026** its scope widened to the whole platform: every [[Claude API]] endpoint is now runnable from the terminal, the Messages API included.
It is **not** a coding agent like [[Claude Code]]. It's a thin, scriptable wrapper over the API. MIT licensed, written in Go, runs on macOS, Linux and Windows.
Worth knowing: coding agents understand `ant` well through the `claude-api` skill, so "write me a script that calls Claude" produces working CLI calls instead of hand-rolled `curl`. See [[AI Agent Skills]].
## Install
```bash
brew install anthropics/tap/ant # Homebrew
go install 'github.com/anthropics/anthropic-cli/cmd/ant@latest' # Go 1.22+
```
Go installs land in `$(go env GOPATH)/bin` — add it to `PATH` if `ant` isn't found.
## Auth
```bash
ant auth login # log in with your Claude Console account
```
Or export `ANTHROPIC_API_KEY` with a key from the [[Claude Console]]. The login flow is the newer path and avoids keeping a static key in your shell profile.
## Command shape
```
ant <resource>[:<subresource>] <command> [flags...]
```
Structured flags accept relaxed JSON or YAML, so unquoted keys are fine.
```bash
# The Messages API, from the terminal
ant messages create \
--model claude-opus-4-8 \
--max-tokens 1024 \
--message '{role: user, content: "Hello, Claude"}'
# List and inspect models
ant models list
ant models retrieve --model-id claude-opus-4-8
# Beta resources: agents, sessions, environments, files, memory stores, skills
ant beta:agents list
ant beta:sessions create --agent "$AGENT_ID" --environment "$ENV_ID"
```
`ant --help` lists every resource; append `--help` to any command for its flags.
## The flags that make it useful
- **`--transform <path> --raw-output`** — jq-style field extraction, e.g. `--transform content.0.text` to get just the model's reply. Ideal for capturing an ID into a shell variable.
- **`@path` file syntax** — inline a local file into a structured flag instead of base64-encoding it yourself:
```bash
ant messages create --model claude-opus-4-8 --max-tokens 1024 \
--message '{role: user, content: [
{type: image, source: {type: base64, media_type: image/jpeg, data: "@photo.jpg"}},
{type: text, text: "What is in this image?"}
]}'
```
- **Interactive explorer** — the default output in a terminal; browse a response instead of scrolling raw JSON.
- **`--format yaml|json`** — machine-readable output when piping.
- **stdin** — reads YAML when the payload is too big for a flag.
## When to reach for it
Shell scripting, CI, and hand-debugging production sessions. It removes the `curl + jq` boilerplate from every line, and the nested resources of Managed Agents are far more readable as commands than as HTTP.
For real applications, the official SDKs (Python, TypeScript, Go, Java, C#, Ruby, PHP) remain the better choice. See [[Anthropic SDK]].
## References
- Repository: https://github.com/anthropics/anthropic-cli
- Documentation: https://platform.claude.com/docs/en/api/sdks/cli
- Releases: https://github.com/anthropics/anthropic-cli/releases
- Managed Agents quickstart: https://platform.claude.com/docs/en/managed-agents/quickstart
- Announcement (2 June 2026): https://x.com/ClaudeDevs/status/2061877343078244459
## Related
- [[Claude Platform]]
- [[Claude API]]
- [[Claude Managed Agents]]
- [[Anthropic SDK]]
- [[Claude Code]]
- [[Claude Console]]
- [[AI Agent Skills]]
- [[Anthropic]]