ai-commit
ai-commit copied to clipboard
feat: add Claude/Anthropic AI provider support
Summary
This PR adds support for Claude (Anthropic) as an AI provider with flexible authentication options.
Features
Dual Authentication Modes
-
CLI Mode (default): Uses the installed
claudeCLI command, authenticated viaclaude setup-token- Perfect for users with Claude Pro/Max subscriptions
- No API key required
- Leverages existing Claude Code authentication
-
API Mode: Direct API access using Anthropic API key
- For users with pay-as-you-go API access
- Simply configure the API key in settings
Configuration
- Automatic mode detection based on API key presence
- Configurable model selection (default:
claude-sonnet-4-5-20250929) - Adjustable temperature setting (0-1)
- Graceful error handling with helpful messages
Changes
- ✨ Add
src/claude-utils.tswith Claude API/CLI integration - 🔧 Update
src/config.tswith Claude configuration keys - 🔌 Update
src/generate-commit-msg.tsto support Claude provider - 📦 Update
package.jsonwith Claude settings and@anthropic-ai/sdkdependency - 📝 Update keywords and description to include Claude/Anthropic
Testing
Tested both authentication modes:
- ✅ CLI mode with
claude setup-tokenauthentication - ✅ API mode with Anthropic API key
Usage
CLI Mode (No API Key Required)
- Install Claude Code CLI: https://claude.com/claude-code
- Authenticate:
claude setup-token - Set AI Provider to
claudein extension settings - Leave Claude API Key empty
API Mode
- Get an API key from https://console.anthropic.com/
- Set AI Provider to
claude - Configure Claude API Key in settings
🤖 Generated with Claude Code