anthropic
Interact with Claude AI from the command line
TLDR
Send a simple message to Claude
SYNOPSIS
anthropic [-g role content] [-m model] [-s system] [-i image] [-t temp] [-x tokens]
DESCRIPTION
anthropic is a command-line interface for interacting with Anthropic's Claude AI models. It provides direct access to the Claude API from the terminal, allowing users to send text messages and images for analysis.
The tool supports multi-turn conversations by chaining multiple -g flags, enabling context-aware interactions. It handles various image formats including PNG, JPEG, and PDF files for vision tasks. The CLI integrates well with shell pipelines, making it useful for scripting and automation workflows.
PARAMETERS
-g, --message role content
Add a message with the specified role (user/assistant) and content. Can be repeated for multi-turn conversations.-m, --model model
Specify the Claude model to use. Default: claude-3-opus-20240229.-s, --system prompt
System message providing context or instructions for the conversation.-i, --image path
Path to an image file (PNG, JPEG, or PDF) for vision tasks.-t, --temperature value
Controls response randomness. Higher values produce more creative outputs.-k, --top_k value
Restricts sampling to the top k most likely tokens.-p, --top_p value
Nucleus sampling; restricts to tokens with cumulative probability above threshold.-x, --max_tokens count
Maximum number of tokens in the response. Default: 1024.
CAVEATS
Requires an ANTHROPIC_API_KEY environment variable to be set with valid API credentials. PDF processing requires the Poppler library to be installed on the system. API usage incurs costs based on token consumption.
HISTORY
The anthropic-cli tool was developed as a community project to provide command-line access to Anthropic's Claude models. It leverages the official Anthropic Python SDK and was created to fill the gap for developers preferring terminal-based workflows over web interfaces.
