ai-commit icon indicating copy to clipboard operation
ai-commit copied to clipboard

feat: add Claude/Anthropic AI provider support

Open noctuum opened this issue 1 month ago • 0 comments

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 claude CLI command, authenticated via claude 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.ts with Claude API/CLI integration
  • 🔧 Update src/config.ts with Claude configuration keys
  • 🔌 Update src/generate-commit-msg.ts to support Claude provider
  • 📦 Update package.json with Claude settings and @anthropic-ai/sdk dependency
  • 📝 Update keywords and description to include Claude/Anthropic

Testing

Tested both authentication modes:

  • ✅ CLI mode with claude setup-token authentication
  • ✅ API mode with Anthropic API key

Usage

CLI Mode (No API Key Required)

  1. Install Claude Code CLI: https://claude.com/claude-code
  2. Authenticate: claude setup-token
  3. Set AI Provider to claude in extension settings
  4. Leave Claude API Key empty

API Mode

  1. Get an API key from https://console.anthropic.com/
  2. Set AI Provider to claude
  3. Configure Claude API Key in settings

🤖 Generated with Claude Code

noctuum avatar Nov 13 '25 01:11 noctuum