Skip to content
| Marketplace
Sign in
Visual Studio Code>SCM Providers>AI Git Commit MessageNew to Visual Studio Code? Get it now.
AI Git Commit Message

AI Git Commit Message

Irfan ali

| (0) | Free
AI-generated git commit messages from your staged diff. Works with Claude, ChatGPT, Gemini, Ollama or any OpenAI-compatible provider.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

AI Git Commit Message

Adds a Generate Commit Message with AI button to the Source Control view. It reads your staged diff, asks an AI provider of your choice to describe it, and writes the message into the commit box for you to edit.

It never commits for you — you always get the last look.

Provider setup

Pick one. Every option needs either a signed-in CLI or an API key — nothing is bundled with the extension.

Fastest: a CLI you already have

If claude, codex, gemini or ollama is installed and signed in, there is nothing to configure. Leave autoCommit.provider on auto and it uses the first one it finds. No API key, no billing setup — it reuses the subscription you already pay for.

To pin a specific one, set autoCommit.provider to claude-cli, codex-cli, gemini-cli or ollama-cli.


ChatGPT — without an API key (Codex CLI)

Uses your existing ChatGPT sign-in.

  1. Install the Codex CLI and sign in with your ChatGPT account
  2. Check it works: codex --version
  3. In VS Code, Cmd+, → search autoCommit → set Provider to codex-cli

No key to store, no per-request billing.


ChatGPT — with an API key (OpenAI API)

Billed per request against your OpenAI account, separate from a ChatGPT subscription.

  1. Create a key at https://platform.openai.com/api-keys (starts sk-...)
  2. In VS Code: Cmd+Shift+P → AI Commit: Set API Key → choose openai-api → paste the key
  3. Cmd+, → search autoCommit:
    • Provider → openai-api
    • Model → the model id you want. This is required — there is no default, because model names change often

Not sure of the model name? Ask the API for the list:

curl -s https://api.openai.com/v1/models \
  -H "Authorization: Bearer $OPENAI_API_KEY" | grep '"id"'

Pick a small, cheap one — a commit message is a short, easy task, and the big models cost more for no real gain here.

autoCommit.baseUrl can stay empty; it defaults to https://api.openai.com/v1.


Claude — with an API key

  1. Create a key at https://console.anthropic.com/settings/keys
  2. Cmd+Shift+P → AI Commit: Set API Key → anthropic-api → paste
  3. Cmd+,: Provider → anthropic-api

Model is optional here — it defaults to claude-opus-5. For commit messages claude-haiku-4-5 is faster and much cheaper. autoCommit.effort is set to low by default, which is plenty for this job.


Gemini, Groq, OpenRouter, DeepSeek, Mistral, …

Anything that speaks the OpenAI /chat/completions format works through one setting.

  1. Get a key from that provider
  2. Cmd+Shift+P → AI Commit: Set API Key → openai-compatible → paste
  3. Cmd+,:
    • Provider → openai-compatible
    • Base Url → from the table below
    • Model → a model id that provider offers (required)
Provider Base URL
Groq https://api.groq.com/openai/v1
OpenRouter https://openrouter.ai/api/v1
Together https://api.together.xyz/v1
Mistral https://api.mistral.ai/v1
DeepSeek https://api.deepseek.com/v1
Google Gemini https://generativelanguage.googleapis.com/v1beta/openai/

These are the documented endpoints; if a provider moves theirs, the Base Url setting is a one-line change. Most also answer GET {baseUrl}/models with the list of model ids they accept.


Fully local, no key, no data leaving the machine (Ollama)

  1. Install Ollama and pull a model: ollama pull llama3.1
  2. Cmd+,:
    • Provider → ollama-cli
    • Model → llama3.1 (required — Ollama has no default)

Slower than a hosted model, and small models write weaker messages, but your diff never leaves your computer. Raise autoCommit.timeoutSeconds if generation is slow.


Anything else (custom command)

For a CLI not listed above. The prompt is written to the command's stdin and the message read from its stdout.

  1. Cmd+,:
    • Provider → custom-cli
    • Cli Command → the executable, e.g. /usr/local/bin/mytool
    • Cli Args → arguments, one per array entry

cliCommand, cliArgs, claudePath and baseUrl are read from your user settings only, never from a repository's .vscode/settings.json, so cloning a repo cannot make the button run someone else's program.


Checking it works

Open a repo with changes and click the wand. If something is missing, the error names the exact setting to fix:

Error Fix
No API key stored for ... AI Commit: Set API Key for that provider
Set "autoCommit.model" ... That provider needs an explicit model id
Set "autoCommit.baseUrl" ... Fill in the Base Url from the table
Could not find "codex" on your PATH Not installed, or set the full path
HTTP 401 Key is wrong or expired — set it again
HTTP 404 Base Url or model id is wrong

Privacy

Your diff is sent to whichever provider you configure, under your own account. Don't point it at a provider you would not paste your code into. With ollama-cli the model runs locally and nothing leaves your machine.

Settings that can run a command or redirect your prompt — cliCommand, cliArgs, claudePath, baseUrl — are read from your user settings only, never from a repository's .vscode/settings.json, so cloning a repo cannot hijack them.

Commands

Open the Command Palette with Cmd+Shift+P (Ctrl+Shift+P on Windows/Linux) and type AI Commit to see all three.

Command What it does When you need it
AI Commit: Generate Commit Message with AI Reads the diff and fills the commit box Every time — this is the main one. Same as clicking the wand
AI Commit: Set API Key Asks which provider, then stores a key in VS Code secret storage Once per provider, during setup. Also to replace an expired key
AI Commit: Clear Stored API Key Deletes the stored key for a provider Switching providers, or removing a key from a shared machine

The three ways to run the main command

  1. The wand icon in the Source Control view toolbar, at the top of the panel
  2. Right-click a repository in the Source Control list → Generate Commit Message with AI — the precise way to pick one repo out of many
  3. The Command Palette — always works, and the quickest way to tell whether the extension loaded at all

All three do exactly the same thing: fill the commit box with a draft. None of them commits.

Settings, not commands

Everything else is configuration rather than a command: Cmd+, then search autoCommit. See Settings below.

Usage

  1. Open Source Control and select a repository.
  2. Stage the files you want described (optional — with nothing staged it describes the whole working tree, like VS Code's own commit-all).
  3. Click the wand at the top of the Source Control view, or run Generate Commit Message with AI from the Command Palette.
  4. Edit the result and commit.

Issue keys

If the branch name contains an issue key (bugfix/PROJ-482-retry-backoff), that key is required in the subject line. If the branch has no key, none is invented — so repository hooks that enforce a key still do their job.

Change or disable this with autoCommit.jiraKeyPattern.

Settings

Setting Default What it does
autoCommit.provider auto Which provider generates the message
autoCommit.model — Model name; required for Ollama and the OpenAI paths
autoCommit.baseUrl — API endpoint for openai-compatible
autoCommit.effort low Reasoning effort, Anthropic API only
autoCommit.cliCommand / cliArgs — Command for custom-cli
autoCommit.claudePath auto-detect Path to claude if not on PATH
autoCommit.jiraKeyPattern [A-Z][A-Z0-9]{1,9}-[0-9]+ Issue key regex; empty disables
autoCommit.maxDiffBytes 120000 Diff truncation limit
autoCommit.recentCommitCount 10 Past subjects used to match repo style
autoCommit.timeoutSeconds 90 Give up after this long
autoCommit.instructions — Extra house rules for the prompt

Author

Irfan Ali — irfanali07038838@gmail.com

MIT licensed. Not affiliated with or endorsed by Anthropic, OpenAI or Google.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft