claude4
v0.1.0
Published
Official CLI tool for Claude AI interactions
Downloads
2
Maintainers
Readme
Claude4 CLI
Official command-line interface for Claude AI interactions.
Installation
npm install -g claude4Quick Start
- Get your API key from Anthropic Console
- Login to the CLI:
claude4 auth login - Start chatting:
claude4 chat "Hello Claude!" # or claude4 chat --interactive
Features
Authentication
- Login/Logout: Secure API key management
- Status Check: Verify authentication status
- Credentials stored in
~/.claude4rc.json
Chat
- Single Messages:
claude4 chat "Your message" - Interactive Mode:
claude4 chat --interactive - File Input:
claude4 chat -f document.txt - Model Override:
claude4 chat -m claude-3-opus-20240229 - Temperature Control:
claude4 chat -t 0.3
Configuration
- View Settings:
claude4 config list - Set Values:
claude4 config set model claude-3-opus-20240229 - Get Value:
claude4 config get model - Interactive Editor:
claude4 config edit - Reset to Defaults:
claude4 config reset
Commands
Authentication
# Login with API key
claude4 auth login
# Check authentication status
claude4 auth whoami
# Logout and clear credentials
claude4 auth logoutChat
# Send a single message
claude4 chat "Explain quantum computing"
# Interactive chat session
claude4 chat --interactive
# Send file contents
claude4 chat -f README.md "Summarize this document"
# Override model
claude4 chat -m claude-3-opus-20240229 "Complex reasoning task"
# Set temperature
claude4 chat -t 0.1 "Be very focused and precise"Configuration
# View all configuration
claude4 config list
# Set configuration values
claude4 config set model claude-3-opus-20240229
claude4 config set temperature 0.3
claude4 config set maxTokens 8192
# Get specific value
claude4 config get model
# Interactive configuration editor
claude4 config edit
# Reset to defaults
claude4 config resetConfiguration Options
| Key | Description | Default |
|-----|-------------|---------|
| baseUrl | Anthropic API endpoint | https://api.anthropic.com |
| model | Claude model to use | claude-3-haiku-20240307 |
| temperature | Response creativity (0-1) | 0.7 |
| maxTokens | Maximum response length | 4096 |
| apiKey | Your Anthropic API key | (none) |
Available Models
claude-3-haiku-20240307- Fast and efficient (default)claude-3-sonnet-20240229- Balanced performanceclaude-3-opus-20240229- Most capable
Examples
Basic Usage
# Simple question
claude4 chat "What is the capital of France?"
# Code explanation
claude4 chat -f app.js "Explain this code"
# Creative writing
claude4 chat -t 0.9 "Write a short story about a robot"Interactive Session
claude4 chat --interactive
# Now you can have a back-and-forth conversation
# Type 'exit' or 'quit' to end the sessionConfiguration
# Set up for creative tasks
claude4 config set model claude-3-opus-20240229
claude4 config set temperature 0.8
# Set up for analytical tasks
claude4 config set model claude-3-sonnet-20240229
claude4 config set temperature 0.2Development
Build from Source
git clone <repository-url>
cd claude4-cli
npm install
npm run build
npm linkRun Tests
npm testDevelopment Mode
npm run devTroubleshooting
Authentication Issues
- Ensure your API key is valid and starts with
sk-ant- - Check your internet connection
- Verify your API key hasn't expired
Configuration Problems
- Reset configuration:
claude4 config reset - Check configuration:
claude4 config list - Re-run authentication:
claude4 auth login
Connection Issues
- Check your internet connection
- Verify the base URL is correct
- Try with a different model
Support
For issues and support:
- Check the documentation
- Report bugs on GitHub Issues
License
MIT
