• Messages
  • Managed Agents
  • Admin
Search...
⌘K
CLI, SDKs, and libraries
Overview
ant CLI
QuickstartAuthentication optionsUsing the CLIScripting and automation
Client SDKs
PythonTypeScriptC#GoJavaPHPRuby
Libraries and integrations
OpenAI SDK compatibility
Log in
Quickstart
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Solutions

  • AI agents
  • Code modernization
  • Coding
  • Customer support
  • Education
  • Financial services
  • Government
  • Life sciences

Partners

  • Amazon Bedrock
  • Google Cloud's Vertex AI

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Company

  • Anthropic
  • Careers
  • Economic Futures
  • Research
  • News
  • Responsible Scaling Policy
  • Security and compliance
  • Transparency

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Help and security

  • Availability
  • Status
  • Support
  • Discord

Terms and policies

  • Privacy policy
  • Responsible disclosure policy
  • Terms of service: Commercial
  • Terms of service: Consumer
  • Usage policy
CLI, SDKs, and libraries/ant CLI

CLI quickstart

Install the ant command-line tool, authenticate, and send your first request to the Claude API.

The ant CLI provides access to the Claude API from your terminal. Every API resource is exposed as a subcommand, with output formatting, response filtering, and support for YAML or JSON file input that make it practical for both interactive exploration and automation.

Compared to calling the API with curl, ant lets you build request bodies from typed flags or piped YAML rather than hand-written JSON, inline file contents into string fields with an @path reference, and extract fields from the response with a built-in --transform query (no separate JSON tooling required). List endpoints paginate automatically. Claude Code has native support for ant.

For endpoint-specific parameters and response schemas, see the API reference. This page gets you to a working command. For everything else the CLI does, see Using the CLI and CLI scripting and automation.

Installation

Check the installation:

ant --version

Authentication

ant auth login opens a browser-based OAuth flow against the Claude Console and stores the resulting credentials locally, so you can call the API without creating or managing an API key.

CLI
ant auth login

For other ways to authenticate (API key environment variable, headless hosts, multiple workspaces, named profiles, and Workload Identity Federation), see CLI authentication options.

Send your first request

With the binary installed and authenticated, call the Messages API:

ant messages create \
  --model claude-opus-4-8 \
  --max-tokens 1024 \
  --message '{role: user, content: "Hello, Claude"}'
Output
{
  "model": "claude-opus-4-8",
  "id": "msg_01YMmR5XodC5nTqMxLZMKaq6",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Hello! How are you doing today? Is there something I can help you with?"
    }
  ],
  "stop_reason": "end_turn",
  "usage": { "input_tokens": 27, "output_tokens": 20 /*, ... */ }
}

The response is the full API object, pretty-printed because stdout is a terminal.

Shell completion

The CLI ships completion scripts for bash, zsh, fish, and PowerShell. Generate and install one for your shell:

Next steps

  • CLI authentication options: API keys, headless hosts, multiple workspaces, and named profiles
  • Using the CLI: command structure, output formats, GJSON transforms, and request bodies
  • CLI scripting and automation: version-control API resources, scripting patterns, and use from Claude Code

Was this page helpful?

  • Installation
  • Authentication
  • Send your first request
  • Shell completion
  • Next steps