Claude Code (claude) is Anthropic's command-line AI coding assistant. It's NOT the same as the Claude API — it's a local CLI that helps with terminal tasks, coding, and more.
| Feature | Claude API | Claude Code |
|---|---|---|
| Usage | HTTP calls, pay per token | Local CLI, subscription |
| Context | API calls | File-aware, git-aware |
| Best for | Workflow automation | Interactive coding sessions |
# macOS
brew install anthropic-cli
# Or download from anthropic.com/claude-code
# Then authenticate:
claude auth login
Since Claude Code is interactive, you can:
echo "Explain this git diff" | claude -p
[Node: Execute Command]
Command: echo "Review my latest commit" | claude -p
claude -p --print "Write a Python function to parse CSV files"
# Get git diff
DIFF=$(git diff HEAD~1)
echo "$DIFF" | claude -p "Review this code for bugs"
claude -p "Create a React component for a login form with email/password"
claude -p "Fix this error: $ERROR_MESSAGE"
Claude Code pairs well with GitHub Copilot (Codex):
Claude Code has evolved: