Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>AI Code CommenterNew to Visual Studio Code? Get it now.
AI Code Commenter

AI Code Commenter

banditvault

|
8 installs
| (0) | Free
Automatically add intelligent comments to your code using AI (OpenAI, Claude, Ollama, Azure)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

AI Code Commenter

A VS Code extension that automatically adds intelligent comments to your code using AI. Supports OpenAI, Claude, Ollama (local), and Azure OpenAI.

Features

  • 🤖 Multiple AI Providers: OpenAI, Claude, Ollama (local), Azure OpenAI
  • 💰 Cost Estimation: See estimated cost before processing
  • ⚡ Cancel Anytime: Stop generation mid-process
  • ✅ Partial Accept: Click individual comments to accept/reject them
  • 🗑️ Remove Comments: Strip all comments from a file
  • ⚠️ File Size Warning: Warns before processing large files
  • 📝 Custom Instructions: Add your own rules to the AI prompt
  • 🎯 Inline Diff: Green ✓ for accepted, red ✗ for rejected comments

How It Works

  1. Run command (Ctrl+Alt+C)
  2. Cost estimate shown (optional) - click Continue or Cancel
  3. Progress shown with Cancel button
  4. Comments appear with green highlighting
  5. Click any comment to toggle accept/reject (turns red with strikethrough)
  6. Status bar shows: 12/15 comments (click line to toggle)
  7. Accept (Ctrl+Enter) or Reject All (Esc)

Installation

  1. Download the .vsix file from Releases
  2. In VS Code: Ctrl+Shift+P → "Install from VSIX"
  3. Select the downloaded file

Or search for "AI Code Commenter" in the VS Code Extensions marketplace.

Setup

OpenAI (Default)

  1. Get API key from OpenAI Platform
  2. Ctrl+Shift+P → "AI: Set API Key"
  3. Paste your key

Claude (Anthropic)

  1. Get API key from Anthropic Console
  2. Settings → Change aiCodeCommenter.provider to claude
  3. Ctrl+Shift+P → "AI: Set API Key"

Ollama (Local - Free!)

  1. Install Ollama
  2. Run: ollama pull codellama
  3. Settings → Change aiCodeCommenter.provider to ollama
  4. No API key needed!

Azure OpenAI

  1. Create Azure OpenAI resource
  2. Settings → Set provider, azureEndpoint, azureDeployment
  3. Ctrl+Shift+P → "AI: Set API Key"

Commands

Command Shortcut Description
AI: Comment Current File Ctrl+Alt+C Add comments to entire file
AI: Comment Selected Code Ctrl+Alt+S Add comments to selection
AI: Remove All Comments Ctrl+Alt+R Strip all comments from file
AI: Set API Key - Configure API key for current provider
AI: Accept Changes Ctrl+Enter Accept (non-rejected) changes
AI: Reject Changes Esc Revert all changes

Configuration

Setting Default Description
provider openai AI provider: openai, claude, ollama, azure
openaiModel gpt-4o-mini OpenAI model
claudeModel claude-sonnet-4-20250514 Claude model
ollamaEndpoint http://localhost:11434 Ollama API URL
ollamaModel codellama Ollama model name
commentStyle detailed minimal, detailed, comprehensive
customInstructions "" Custom rules for AI (see below)
showCostEstimate true Show cost before processing
fileSizeWarningThreshold 500 Warn if file exceeds this many lines

Custom Instructions

Add your own rules in Settings → aiCodeCommenter.customInstructions:

Always mention time complexity for algorithms.
Use British English spelling.
Include @throws annotations for functions that can throw.
Keep comments under 80 characters per line.

Cost Estimation

Before processing, you'll see:

Estimated: 2,500 input tokens, 3,750 output tokens. Cost: ~$0.002 (gpt-4o-mini)
[Continue] [Cancel]

Pricing (per 1M tokens)

Model Input Output
gpt-4o-mini $0.15 $0.60
gpt-4o $2.50 $10.00
claude-3-5-sonnet $3.00 $15.00
claude-3-haiku $0.25 $1.25
Ollama Free Free

Partial Accept/Reject

After generation:

  1. Green lines (✓) = Will be kept
  2. Click any green line → Turns red with strikethrough (✗)
  3. Click red line again → Back to green
  4. Status bar updates: 8/12 comments
  5. Accept only applies green lines

This lets you cherry-pick which comments to keep!

Remove Comments

Ctrl+Alt+R or Command Palette → "AI: Remove All Comments"

  • Removes all single-line comments (//, #, etc.)
  • Removes all multi-line comments (/* */, """ """, etc.)
  • Shows preview with Accept/Reject

Supported Languages

Python, JavaScript, TypeScript, JSX/TSX, Java, C, C++, C#, Go, Rust, PHP, Ruby, Swift, Kotlin, and more.

Troubleshooting

Error Solution
Invalid API key Check key format, re-enter via "AI: Set API Key"
Rate limited Wait a moment, try again
Quota exceeded Check billing at provider's dashboard
Cannot connect (Ollama) Ensure Ollama is running: ollama serve

Changelog

1.6.0

  • Added extension icon
  • Published to VS Code Marketplace
  • Publisher: BanditVault

1.5.0

  • Multiple AI Providers: Added Claude, Ollama, Azure OpenAI support
  • Cancel Button: Stop generation anytime
  • Cost Estimation: See estimated cost before processing
  • Partial Accept: Click individual comments to accept/reject
  • Custom Instructions: Add your own rules to the prompt
  • Remove Comments: New command to strip all comments
  • File Size Warning: Warns before processing large files
  • Keyboard Shortcuts: Ctrl+Enter to accept, Esc to reject

1.4.0

  • Flicker-free generation
  • Non-modal accept/reject in status bar

1.3.0

  • Live streaming output
  • Improved diff detection

1.2.0

  • Inline diff view with green/yellow highlighting

1.1.0

  • Streaming API support
  • Version management via version.txt

1.0.0

  • Initial release

License

MIT License - see LICENSE file.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft