A simple Go-based CLI tool for interacting with the Anthropic API
Find a file
Leo 80002ea195 Prioritize global config over local .env file
Check ~/.config/prompt/config and ~/.prompt.env before .env in current
directory. This prevents issues when running prompt in project directories
that have their own .env files for other purposes.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 10:31:39 +02:00
.env.example Add Go implementation with streaming responses and rename to prompt 2026-01-13 10:22:27 +02:00
.gitignore Initial commit 2025-11-14 21:24:51 +02:00
go.mod Add Go implementation with streaming responses and rename to prompt 2026-01-13 10:22:27 +02:00
go.sum Add Go implementation with streaming responses and rename to prompt 2026-01-13 10:22:27 +02:00
main.go Prioritize global config over local .env file 2026-01-13 10:31:39 +02:00
main.sh Add Go implementation with streaming responses and rename to prompt 2026-01-13 10:22:27 +02:00
README.md Prioritize global config over local .env file 2026-01-13 10:31:39 +02:00

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

Installation

  1. Clone and build:
git clone <your-repo-url>
cd anthropic-cli
go build -o prompt
  1. 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:

  1. ~/.config/prompt/config (XDG standard location)
  2. ~/.prompt.env (home directory)
  3. .env in the current directory (for project-specific overrides)

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 key
  • MODEL (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:

  1. Send your initial message to Claude
  2. Stream the response in real-time
  3. 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