MCPcopy Index your code
hub / github.com/anthropics/anthropic-cli

github.com/anthropics/anthropic-cli @v1.16.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.16.0 ↗ · + Follow
715 symbols 2,797 edges 93 files 167 documented · 23% updated 1d agov1.16.0 · 2026-07-02★ 565
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ant — Claude Platform CLI

GitHub release Homebrew

ant is the official CLI for the Claude Platform. It puts the Claude API in your terminal — send messages, manage agents and sessions, upload files, and script against every API endpoint.

Demo of the ant CLI

Documentation

Full documentation is available at platform.claude.com/docs/en/api/sdks/cli.

Installation

Homebrew

brew install anthropics/tap/ant

Go

To install from source, you need Go version 1.22 or later.

go install 'github.com/anthropics/anthropic-cli/cmd/ant@latest'

The binary is placed in $(go env GOPATH)/bin. If ant isn't found after installation, add that directory to your PATH:

# Add to your shell profile (.zshrc, .bashrc, etc.)
export PATH="$PATH:$(go env GOPATH)/bin"

Getting started

Log in with your Claude Console account:

ant auth login

Or set the ANTHROPIC_API_KEY environment variable to an API key from the Claude Console.

Then send your first message:

ant messages create \
  --model claude-opus-4-8 \
  --max-tokens 1024 \
  --message '{role: user, content: "Hello, Claude"}'

Structured flags accept relaxed JSON or YAML, so unquoted keys are fine.

Usage

The CLI follows a resource-based command structure, with nested resources separated by colons:

ant <resource>[:<subresource>] <command> [flags...]
# List available models
ant models list

# Browse a response in the interactive explorer (the default in a terminal)
ant models retrieve --model-id claude-opus-4-8

# Extract a single field from a response, jq-style
ant messages create \
  --model claude-opus-4-8 \
  --max-tokens 1024 \
  --message '{role: user, content: "Hello, Claude"}' \
  --transform content.0.text --raw-output

# Send a file using the @path syntax
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?"}
  ]}'

# Manage beta resources such as agents, sessions, and files
ant beta:agents list

Run ant --help for the full list of resources, or append --help to any command to see its flags.

Requirements

macOS, Linux, or Windows.

Contributing

See CONTRIBUTING.md.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Extension points exported contracts — how you extend this code

JSONView (Interface)
(no doc) [2 implementers]
internal/jsonview/explorer.go
InRequest (Interface)
InRequest interface for flags that should be included in HTTP requests
internal/requestflag/requestflag.go
Marshaler (Interface)
(no doc)
internal/apiform/form.go
Queryer (Interface)
(no doc)
internal/apiquery/query.go
AnyIterator (Interface)
An iterator over `any` values
internal/jsonview/explorer.go
SettableInnerField (Interface)
Allow setting inner fields on other flags (e.g. --foo.baz can set the "baz" field on the --foo flag)
internal/requestflag/requestflag.go
Iterator (Interface)
A generic iterator interface that is used by the `genericIterator` struct below to convert iterators over specific types
internal/jsonview/explorer.go
InnerFieldSeeder (Interface)
InnerFieldSeeder lets an InnerFlag prepare its outer flag's underlying value before dispatching SetInnerField. This is o
internal/requestflag/requestflag.go

Core symbols most depended-on inside this repo

String
called by 328
internal/requestflag/requestflag.go
IsSet
called by 277
internal/requestflag/requestflag.go
Set
called by 171
internal/requestflag/requestflag.go
Get
called by 136
internal/requestflag/requestflag.go
flagOptions
called by 116
pkg/cmd/flagoptions.go
getDefaultRequestOptions
called by 116
pkg/cmd/cmdutil.go
ShowJSON
called by 115
pkg/cmd/cmdutil.go
Close
called by 54
pkg/cmd/flagoptions.go

Shape

Function 504
Method 152
Struct 34
Interface 12
TypeAlias 12
FuncType 1

Languages

Go100%

Modules by API surface

internal/requestflag/requestflag.go71 symbols
internal/jsonview/explorer.go69 symbols
pkg/cmd/cmd_auth_test.go57 symbols
pkg/cmd/cmd_auth.go41 symbols
internal/requestflag/innerflag.go28 symbols
pkg/cmd/cmdutil.go24 symbols
pkg/cmd/flagoptions.go20 symbols
internal/autocomplete/autocomplete_test.go20 symbols
internal/autocomplete/autocomplete.go17 symbols
pkg/cmd/cmdutil_test.go12 symbols
internal/requestflag/requestflag_test.go11 symbols
internal/apiform/encoder.go10 symbols

For agents

$ claude mcp add anthropic-cli \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact