anthropics/anthropic-cli

The CLI for the Claude API

ant – Claude Platform CLI

What it is

  • ant is the official command‑line interface for Anthropic’s Claude Platform. It lets you call the Claude large‑language‑model API directly from your terminal.

Key capabilities

  • Message handling – send prompts, receive completions, and pipe results into other tools.
  • Resource management – list models, create and manage beta resources such as agents, sessions, and uploaded files.
  • Convenient auth – log in with your Claude Console account, use an ANTHROPIC_API_KEY env var, or pipe a secret from a manager (e.g., 1Password) via stdin.
  • Output shaping – extract fields with a jq‑style --transform flag and output raw text for scripting.
  • File uploads – embed images or other files in messages using the @path syntax.

Installation

  • Homebrew (macOS/Linux): brew install anthropics/tap/ant
  • From source (any platform): install Go 1.22+, then run go install 'github.com/anthropics/anthropic-cli/cmd/ant@latest'. The binary lands in $(go env GOPATH)/bin.

Getting started

  1. Authenticate:
    ant auth login
    # or set ANTHROPIC_API_KEY with a key from the Claude Console
    
  2. Send a simple prompt:
    ant messages create \
      --model claude-opus-4-8 \
      --max-tokens 1024 \
      --message '{role: user, content: "Hello, Claude"}'
    
    The CLI accepts relaxed JSON/YAML, so you don’t need to quote every key.

Typical command pattern

ant <resource>[:<subresource>] <command> [flags]
  • Example: ant models list – shows all available Claude models.
  • Example: ant beta:agents list – lists beta‑stage agents.
  • Use --help on any command for detailed flag information.

Why it matters

  • Provides a lightweight, script‑friendly way to integrate Claude into automation pipelines, CI jobs, or personal tooling without writing code.
  • Mirrors the full Claude API surface, so anything you can do via HTTP you can do from the terminal.

License

  • MIT License (see LICENSE).

Further reading

相关

  • 项目
  • 项目
  • 项目
  • 项目
  • 项目