AI-powered git commit message generator supporting multiple providers (Gemini, Claude)
Project description
Commit with AI
AI-powered git commit message generator supporting multiple AI providers (Gemini API, Claude CLI).
What It Does
Analyzes your staged git changes and generates 5 Conventional Commits-compliant commit message suggestions using AI. Select one or enter your own.
Installation
Via PyPI (Recommended)
# Use uvx (no installation required)
uvx commit-with-ai
# Or install globally
pip install commit-with-ai
From Source
git clone https://github.com/chenwei791129/commit-with-ai.git
cd commit-with-ai
uv run -m commit_with_ai
Setup
Provider Selection
Choose your AI provider via --provider flag or COMMIT_AI_PROVIDER environment variable:
# Use Gemini (default)
commit-with-ai
# Use Claude CLI
commit-with-ai --provider claude-cli
# Or set via environment variable
export COMMIT_AI_PROVIDER="claude-cli"
Priority: --provider flag > COMMIT_AI_PROVIDER env > default (gemini)
Model Selection
Override the default model via --model flag or COMMIT_AI_MODEL environment variable:
# Use a specific model
commit-with-ai --provider claude-cli --model sonnet
# Or set via environment variable
export COMMIT_AI_MODEL="sonnet"
Priority: --model flag > COMMIT_AI_MODEL env > provider default
Gemini Provider (Default)
Set your Gemini API key:
export GEMINI_API_KEY="your-api-key-here"
Get your API key from Google AI Studio.
| Setting | Default |
|---|---|
| Model | gemini-3-flash-preview |
Claude CLI Provider
Requires Claude Code installed and authenticated locally. No API key needed — uses your existing Claude CLI credentials.
# Install Claude Code (if not already installed)
npm install -g @anthropic-ai/claude-code
# Authenticate
claude login
| Setting | Default |
|---|---|
| Model | haiku |
Configure Git Alias
# If installed via pip
git config --global alias.ac '!commit-with-ai'
# Or if using uvx (no installation)
git config --global alias.ac '!uvx commit-with-ai'
Usage
git add <files>
git ac
# Or with provider/model options
git add <files>
commit-with-ai --provider claude-cli --model sonnet
Environment Variables
| Variable | Description | Default |
|---|---|---|
COMMIT_AI_PROVIDER |
AI provider (gemini, claude-cli) |
gemini |
COMMIT_AI_MODEL |
AI model name | Provider-specific |
GEMINI_API_KEY |
Gemini API key (for gemini provider) | — |
GOOGLE_API_KEY |
Alternative Gemini API key | — |
Example
Analyzing staged changes...
Generating commit message options with claude-cli (haiku)...
======================================================================
Select a commit message:
======================================================================
1. feat(auth): add user authentication system
2. feat: implement login and registration flow
3. chore(deps): add authentication dependencies
4. docs: update README with auth setup instructions
5. refactor(auth): restructure authentication module
6. Enter custom message
7. Cancel
======================================================================
Enter selection [1-7]:
Resources
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file commit_with_ai-1.1.0.tar.gz.
File metadata
- Download URL: commit_with_ai-1.1.0.tar.gz
- Upload date:
- Size: 113.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40ac2f9c95bba3243516ef47db6f4a9488c85558df17afafd247a81f64e48260
|
|
| MD5 |
f46fff01d75fe2dbe36c9d914ec852bc
|
|
| BLAKE2b-256 |
0bd2000cb498594f174932fc3c20fb9c0f74635f1c5b820261a93b28fbf7d876
|
File details
Details for the file commit_with_ai-1.1.0-py3-none-any.whl.
File metadata
- Download URL: commit_with_ai-1.1.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19c66b0bf8d9e9f5ee158bb8fb953cd62540ec15c2b64c86c2bfd7898bd1c978
|
|
| MD5 |
47e3ad5e2eccb70e6282a671ff9434a3
|
|
| BLAKE2b-256 |
ce806034b06c77842a141aa284df915958e5d967fe53beb7c51ffcb04919f3d9
|