- Implement streaming API responses for real-time text output - Add multi-location config file support (.env, ~/.config/prompt/config, ~/.prompt.env) - Rename project from anthropic-cli to prompt - Add interactive conversation loop to bash script - Create README with installation and usage instructions Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2.1 KiB
2.1 KiB
prompt
A simple, fast CLI tool for chatting with Claude using the Anthropic API with real-time streaming responses.
Features
- Interactive chat with Claude in your terminal
- Real-time streaming responses (see text as Claude types)
- Maintains conversation history within a session
- Configurable model and system prompts
- Multi-location config file support
Requirements
- Go 1.21 or higher
- Anthropic API key (get one here)
Installation
- Clone and build:
git clone <your-repo-url>
cd anthropic-cli
go build -o prompt
- Create a symlink for global access:
sudo ln -s $(pwd)/prompt /usr/local/bin/prompt
Or install via Go:
go install
Configuration
The tool looks for configuration files in the following order:
.envin the current directory (for project-specific configs)~/.config/prompt/config(XDG standard location)~/.prompt.env(home directory)
Setup your config:
# Create the config directory
mkdir -p ~/.config/prompt
# Create config file
cat > ~/.config/prompt/config << EOF
ANTHROPIC_API_KEY=your-api-key-here
MODEL=claude-sonnet-4-5-20250929
SYSTEM_PROMPT=
EOF
Configuration options:
ANTHROPIC_API_KEY(required): Your Anthropic API keyMODEL(optional): Model to use (default: claude-sonnet-4-5-20250929)SYSTEM_PROMPT(optional): Custom system prompt for Claude
Usage
Start a conversation:
prompt "Hello, how are you?"
This will:
- Send your initial message to Claude
- Stream the response in real-time
- Enter an interactive chat mode where you can continue the conversation
Type exit or quit to end the conversation.
Examples
# Ask a quick question
prompt "What is the capital of France?"
# Start a coding session
prompt "Help me write a Python function to calculate fibonacci numbers"
# Use a different model (set in config)
# Edit your config file and change MODEL=claude-opus-4-5-20251101
prompt "Explain quantum computing"
Development
Run without building:
go run main.go "your message here"
License
MIT