Linux command
anthropic 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Send a simple message
anthropic -g user "Hello, Claude!"
Send a message
anthropic -g user "[prompt]" -m [claude-3-5-sonnet-20241022]
Analyze an image
anthropic -g user "Describe this image" -i [path/to/image.png]
Set a system prompt
anthropic -g user "[prompt]" -s "You are a helpful coding assistant"
Multi-turn conversation
anthropic -g user "Hello!" -g assistant "Hi there!" -g user "How are you?"
Control response length
anthropic -g user "[prompt]" -x [2048] -t [0.7]
说明
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.
参数
- -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.
FAQ
What is the anthropic command used for?
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.
How do I run a basic anthropic example?
Run `anthropic -g user "Hello, Claude!"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -g, --message _role_ _content_ do in anthropic?
Add a message with the specified role (user/assistant) and content. Can be repeated for multi-turn conversations.