Python 88.3%
TypeScript 7.6%
Shell 4.1%
1# Anthropic `ant` CLI23**Status:** `DOCUMENTED` (not installed locally; no live run). Reference page `api/cli/messages/create` mirrors `POST /v1/messages` 1:1.4**Sources:** https://platform.claude.com/docs/en/cli-sdks-libraries/cli/quickstart · …/cli/using · …/cli/authentication · …/cli/scripting · …/cli/apply · …/cli/sessions-connect · https://platform.claude.com/docs/en/api/cli/messages/create · https://platform.claude.com/docs/en/api/beta-headers5**Machine-readable:** `generated/fragments/sdks/anthropic-sdks.json` (record `language: cli`)6**Last verified:** 2026-09-18 (docs only)78## Install & auth910| | Command |11|---|---|12| Homebrew | `brew install anthropics/tap/ant` |13| Linux tarball | `curl -fsSL https://github.com/anthropics/anthropic-cli/releases/download/v1.33.0/ant_1.33.0_${OS}_${ARCH}.tar.gz \| sudo tar -xz -C /usr/local/bin ant` |14| Go | `go install github.com/anthropics/anthropic-cli/cmd/ant@latest` (Go ≥1.25) |15| Check | `ant --version` |16| Login | `ant auth login` — browser OAuth against the Console, token **scoped to one workspace**, stored under `$ANTHROPIC_CONFIG_DIR/credentials/<profile>.json` |17| Admin | `ant auth login --scope org:admin` under a dedicated profile (org-wide) |18| API key | `ANTHROPIC_API_KEY` env (overrides every profile) or `--api-key`; `ANTHROPIC_AUTH_TOKEN` also honored; `ANTHROPIC_BASE_URL` / `--base-url` |19| Status / logout | `ant auth status` (which credential source & workspace won; not a health check) · `ant auth logout [--all]` |20| Profiles | `ant profile …` (`workspace_id`, `base_url`, `organization_id`, `scope`, `client_id`, `console_url`); `--profile` / `ANTHROPIC_PROFILE`; WIF for CI |21| Reuse token in curl | `ant auth print-credentials --access-token` → `Authorization: Bearer …` (keep `ANTHROPIC_API_KEY`/`ANTHROPIC_AUTH_TOKEN` unset) |22| Completion | `ant @completion zsh\|bash\|fish\|powershell` |2324## Command structure2526`ant <resource> <action>`; nested resources use colons (`ant beta:sessions:events stream`). Beta resources live under `beta:` and add the right `anthropic-beta` header automatically; `--beta a,b` (or repeated) overrides/adds.2728### Global flags2930| Flag | Meaning |31|---|---|32| `--format auto\|json\|jsonl\|yaml\|pretty\|raw\|explore` | `auto` = pretty JSON for create/modify; list/retrieve open the interactive explorer on a TTY, pretty JSON when piped. `jsonl` = one item/event per line. `raw` = raw body bytes, no auto-pagination |33| `--transform <GJSON path>` | reshape/filter (per item on list endpoints) |34| `-r`, `--raw-output` | unquoted strings (like `jq -r`) — not applied to errors |35| `--format-error`, `--transform-error` | same for error responses |36| `--workspace-id wrkspc_…` | `anthropic-workspace-id` header (`ANTHROPIC_WORKSPACE_ID`) |37| `--profile`, `--base-url`, `--api-key`, `--beta` | see above |38| `--debug` | full HTTP request/response on stderr, keys redacted (shows `request-id`) |3940### Request bodies4142Scalars → flags; structured values accept relaxed YAML-ish or strict JSON (`--message '{role: user, content: "Hello"}'`); repeatable flags build arrays (`--tool`, `--message`, `--event`); stdin JSON/YAML document (heredoc `<<'YAML'`) merged with flags (flags win); `@path` inlines file contents into string fields (binary auto-base64; `@file://` text, `@data://` base64; `\@` literal).4344## `ant messages create` (POST /v1/messages)4546```bash47ant messages create --model claude-opus-5 --max-tokens 1024 --message '{role: user, content: "Hello, Claude"}'48ant messages create --stream --format jsonl --model claude-opus-5 --max-tokens 1024 --message '{role: user, content: "Hello"}' \49 | jq -rj 'select(.delta.type? == "text_delta") | .delta.text'50ant --debug messages create --model claude-sonnet-5 --max-tokens 1024 --message '{role: user, content: "Hi"}' # request-id on stderr51ant messages create --stream --format jsonl <<'YAML'52model: claude-sonnet-553max_tokens: 12800054messages:55 - role: user56 content: Write a detailed analysis...57YAML58```5960| Flag | Body / header field |61|---|---|62| `--model`, `--max-tokens`, `--message` (repeatable), `--system` (string or text blocks; `@file.md`), `--stop-sequence` (repeatable), `--stream` | `model`, `max_tokens`, `messages[]`, `system`, `stop_sequences[]`, `stream` |63| `--metadata`, `--service-tier auto\|standard_only`, `--cache-control`, `--container`, `--inference-geo`, `--output-config`, `--thinking`, `--tool` (repeatable), `--tool-choice` | same-named body fields |64| `--temperature`, `--top-p`, `--top-k` | deprecated sampling params (same model rules as the API) |65| `--user-profile-id`, `--workspace-id` | `anthropic-user-profile-id` (beta), `anthropic-workspace-id` headers |66| `--beta a,b` | `anthropic-beta` |6768Output = the full `Message` JSON (or, with `--stream --format jsonl`, one SSE event object per line: `message_start`, `content_block_start`, `content_block_delta{delta.type: text_delta…}`, …). Sibling commands follow the same resource pattern: `ant messages count-tokens`, `ant models list`, `ant models retrieve <id>`, `ant messages:batches …`, `ant files …`, `ant skills …`, `ant beta:agents|sessions|environments …`.6970## Scripting patterns7172- Chain ids: `ant beta:agents list --transform id --raw-output | head -1 | xargs -I{} ant beta:agents retrieve --agent-id {}`73- Errors: `ant … --format-error yaml --transform-error error.message`74- Claude Code can shell out to `ant` directly (no integration code).75- `ant apply [--dry-run|--yes|--force|--prune|--upgrade|--lock-file <p>|-v]` — Managed Agents resources as files (`agents/*.md`, `environments/*.yaml`, `memory_stores/`, `deployments/*.md`, `skills/<dir>/SKILL.md`), lockfile `claude-lock.json` (commit it); CI: `ant apply --yes .` with WIF.76- `ant beta:sessions connect --session-id … [--web] [--no-browser] [-v]` — live transcript, Enter sends `user.message`, Esc interrupts, tool-approval prompts.7778## Not covered here7980Claude Code (`claude` CLI) is a different tool (agentic coding); Agent SDK and Managed Agents are documented elsewhere in this atlas.81