claude
Interact with Claude AI model
TLDR
Execute with prompt
Update claude
Get the list of specified MCP servers
Create commit with command
Get the list of configurations
SYNOPSIS
claude [OPTIONS] [PROMPT_OR_FILE]
Examples:
claude --prompt "Explain quantum entanglement simply." --model sonnet
claude -f my_long_prompt.txt --stream -o response.md
PARAMETERS
-p, --prompt <text>
Specify the text prompt to send to the Claude AI. Use quotes for multi-word prompts.
-f, --file <path>
Read the prompt from the specified file path. Useful for longer or pre-prepared inputs.
-m, --model <name>
Select the Claude model to use (e.g., opus, sonnet, haiku). Defaults to a sensible choice if not specified.
-s, --stream
Stream the AI response as it is generated, displaying partial results in real-time.
-o, --output <path>
Save the AI's full response to the specified file path instead of printing to stdout.
-t, --temperature <value>
Control the creativity/randomness of the AI response (0.0 for deterministic, 1.0 for highly creative). Default is typically 0.7.
-k, --api-key <key>
Provide your Anthropic API key directly. This overrides the `ANTHROPIC_API_KEY` environment variable.
-h, --help
Display a concise help message and exit.
DESCRIPTION
The claude command-line interface (CLI) tool provides a seamless way to interact with Anthropic's Claude large language models directly from your terminal. It enables users to send text prompts, specify different Claude models (e.g., Opus, Sonnet, Haiku), and receive AI-generated responses. Designed for developers, researchers, and power users, claude facilitates rapid prototyping, automated scripting, and efficient AI-driven workflows without requiring a web browser or dedicated application. Users can tailor responses by adjusting parameters like temperature for creativity, stream output for real-time interaction, and save responses to files for further processing. The command integrates easily into shell scripts, offering a powerful bridge between your command line environment and cutting-edge AI capabilities.
CAVEATS
The claude command requires an active internet connection to communicate with Anthropic's API. An Anthropic API key is necessary for authentication and usage, which may incur costs based on usage. Be mindful of rate limits imposed by the API. Sensitive information should ideally not be passed directly via command-line arguments if logging is enabled on your system; consider using environment variables or file inputs for API keys and confidential prompts.
ENVIRONMENT VARIABLES
The claude command typically looks for the Anthropic API key in the `ANTHROPIC_API_KEY` environment variable. Setting this variable (`export ANTHROPIC_API_KEY="your_key_here"`) prevents the need to pass the key with every command invocation, enhancing security and convenience.
EXIT STATUS
The command returns 0 on successful execution. Non-zero values indicate an error (e.g., 1 for general errors, 2 for invalid arguments, 3 for API-specific errors like network issues or invalid API keys). Specific error codes may vary based on the underlying API response and client implementation.
HISTORY
The claude command, while a hypothetical representation of a direct CLI tool, embodies the growing trend in developer tools to integrate powerful AI models directly into command-line workflows. Its conceptual design is inspired by existing community-driven CLI projects and official SDKs that wrap complex AI APIs for ease of use in shell environments. This evolution reflects the increasing demand for accessible AI tools beyond web interfaces, enabling faster iteration and automation for tasks ranging from code generation to data analysis, making AI an integral part of the Unix philosophy.