A CLI tool that generates concise and descriptive git commit messages using LLMs (Large Language Models).
- β Uses LLMs to generate meaningful commit messages from your changes
- β Supports multiple LLM providers (OpenRouter, Ollama, OpenAI compatible api)
- β Custom api keys for services through open router api (for google aistudio and etc) - go to https://openrouter.ai/settings/integrations and paste key from any of them: AI21, Amazon BedRock, Anthropic, AnyScale, Avian.io, Cloudflare, Cohere, DeepInfra, DeepSeek, Fireworks, Google AI Studio, Google Vertex, Hyperbolic, Infermatic, Inflection, Lambda, Lepton, Mancer, Mistral, NovitaAI, OpenAI, Perplexity, Recursal, SambaNova, SF Compute, Together, xAI
- β Fast and efficient - works directly from your terminal
- β Easy configuration and customization
- β Transparent token usage and cost tracking
- β Version management with automatic incrementation
- β Version synchronization with Cargo.toml
- β Provider management (add, list, set active)
- β Interactive configuration setup
- β Configuration file editing
- β
Add all to stash functionality (
aicommit --add
) - β
Auto push functionality (
aicommit --push
) - β
Auto pull functionality (
aicommit --pull
) - β
Interactive commit message generation (
aicommit --dry-run
) - β Basic .gitignore file checks and management (create ~/.default_gitignore and use it as template if there is no .gitignore in this directory)
- β
Watch mode (
aicommit --watch 1m
) - β
Watch with edit delay (
aicommit --watch 1m --wait-for-edit 30s
) - β OpenAI compatible API support
- β
Help information display (
aicommit --help
)
- π§ Tests for each feature to prevent breaking changes
- π§ Split commits by file (
aicommit --by-file
) - π§ Split commits by feature (
aicommit --by-feature
) - π§ Version management for multiple languages (package.json, requirements.txt, etc.)
- π§ Version management with git tag
- π§ Branch safety checks for push operations
- π§ Support for cross-compilation (ARM, AARCH64, etc.)
- π§ Installation from binary
- π§ Publication management
- π§ Publication in brew/macports
- π§ Publication in apt/apk/yum/pacman
- π§ Publication in npm
- π§ Publication in other package managers
- π§ Support for submodules
- π§ Support for mercurial
Legend:
- β Implemented
- π§ Planned
- π§ͺ Has tests
There are several ways to install aicommit:
If you have Rust installed:
cargo install aicommit
You can download pre-built binaries from the GitHub Releases page.
Available builds:
- Linux (x86_64, ARM64)
- macOS (Intel x86_64, Apple Silicon ARM64)
- Windows (x86_64, ARM64)
# 1. Download and extract (replace VERSION and ARCH with appropriate values)
wget https://github.com/suenot/aicommit/releases/download/vVERSION/aicommit-ARCH.tar.gz
tar xzf aicommit-ARCH.tar.gz
# Example for Linux x86_64:
wget https://github.com/suenot/aicommit/releases/download/v0.1.25/aicommit-linux-x86_64.tar.gz
tar xzf aicommit-linux-x86_64.tar.gz
# Example for macOS ARM64:
wget https://github.com/suenot/aicommit/releases/download/v0.1.25/aicommit-macos-aarch64.tar.gz
tar xzf aicommit-macos-aarch64.tar.gz
# Example for macOS x86_64:
wget https://github.com/suenot/aicommit/releases/download/v0.1.25/aicommit-macos-x86_64.tar.gz
tar xzf aicommit-macos-x86_64.tar.gz
# 2. Make it executable
chmod +x aicommit
# 3. Move to a directory in your PATH (optional)
sudo mv aicommit /usr/local/bin/
- Download the ZIP file for your architecture
- Extract the executable
- Add the directory to your PATH or move the executable to a directory in your PATH
If you want to build the latest version from source:
# 1. Clone the repository
git clone https://github.com/suenot/aicommit
cd aicommit
# 2. Build and install
cargo install --path .
Requirements for building from source:
- Rust toolchain (install from rustup.rs)
- A C compiler (gcc, clang, or MSVC)
- OpenSSL development packages (on Linux)
-
Add a provider (choose one method):
Interactive mode:
aicommit --add-provider
Non-interactive mode (example with OpenRouter):
aicommit --add-provider --add-openrouter --openrouter-api-key "your-api-key"
-
Make some changes to your code
-
Create a commit:
# Commit only staged changes (files added with git add) aicommit # Automatically stage and commit all changes aicommit --add # Stage all changes, commit, and push aicommit --add --push
Add a provider in interactive mode:
aicommit --add-provider
Add providers in non-interactive mode:
# Add OpenRouter provider
aicommit --add-provider --add-openrouter --openrouter-api-key "your-api-key" --openrouter-model "mistralai/mistral-tiny"
# Add Ollama provider
aicommit --add-provider --add-ollama --ollama-url "http://localhost:11434" --ollama-model "llama2"
# Add OpenAI compatible provider
aicommit --add-provider --add-openai-compatible \
--openai-compatible-api-key "your-api-key" \
--openai-compatible-api-url "https://api.deep-foundation.tech/v1/chat/completions" \
--openai-compatible-model "gpt-4o-mini"
Optional parameters for non-interactive mode:
--max-tokens
- Maximum number of tokens (default: 50)--temperature
- Controls randomness (default: 0.3)
List all configured providers:
aicommit --list
Set active provider:
aicommit --set <provider-id>
Automatically increment version in a file before commit:
aicommit --add --version-file "./version" --version-iterate
Synchronize version with Cargo.toml:
aicommit --add --version-file "./version" --version-cargo
Update version on GitHub:
aicommit --add --version-file "./version" --version-github
Both operations can be combined:
aicommit --add --version-file "./version" --version-cargo --version-github --version-iterate
The configuration file is stored at ~/.aicommit.json
. You can edit it directly with:
aicommit --config
Each provider can be configured with the following settings:
max_tokens
: Maximum number of tokens in the response (default: 50)temperature
: Controls randomness in the response (0.0-1.0, default: 0.3)
For OpenRouter, token costs are automatically fetched from their API. For Ollama, you can specify your own costs if you want to track usage.
{
"providers": [{
"id": "550e8400-e29b-41d4-a716-446655440000",
"provider": "openrouter",
"api_key": "sk-or-v1-...",
"model": "mistralai/mistral-tiny",
"max_tokens": 50,
"temperature": 0.3,
"input_cost_per_1k_tokens": 0.25,
"output_cost_per_1k_tokens": 0.25
}],
"active_provider": "550e8400-e29b-41d4-a716-446655440000"
}
- π Google AI Studio - 1000000 tokens for free
- "google/gemini-2.0-flash-exp:free"
- π DeepSeek
- "deepseek/deepseek-chat"
{
"providers": [{
"id": "67e55044-10b1-426f-9247-bb680e5fe0c8",
"provider": "ollama",
"url": "http://localhost:11434",
"model": "llama2",
"max_tokens": 50,
"temperature": 0.3,
"input_cost_per_1k_tokens": 0.0,
"output_cost_per_1k_tokens": 0.0
}],
"active_provider": "67e55044-10b1-426f-9247-bb680e5fe0c8"
}
For example, you can use DeepGPTBot's OpenAI-compatible API for generating commit messages. Here's how to set it up:
-
Get your API key from Telegram:
- Open @DeepGPTBot in Telegram
- Use the
/api
command to get your API key
-
Configure aicommit (choose one method):
Interactive mode:
aicommit --add-provider
Select "OpenAI Compatible" and enter:
- API Key: Your key from @DeepGPTBot
- API URL: https://api.deep-foundation.tech/v1/chat/completions
- Model: gpt-4o-mini
- Max tokens: 50 (default)
- Temperature: 0.3 (default)
Non-interactive mode:
aicommit --add-provider --add-openai-compatible \ --openai-compatible-api-key "your-api-key" \ --openai-compatible-api-url "https://api.deep-foundation.tech/v1/chat/completions" \ --openai-compatible-model "gpt-4o-mini"
-
Start using it:
aicommit
When generating a commit message, the tool will display:
- Number of tokens used (input and output)
- Total API cost (calculated separately for input and output tokens)
Example output:
Generated commit message: Add support for multiple LLM providers
Tokens: 8β 32β
API Cost: $0.0100
You can have multiple providers configured and switch between them by changing the active_provider
field to match the desired provider's id
.
By default, aicommit will only commit changes that have been staged using git add
. To automatically stage all changes before committing, use the --add
flag:
# Only commit previously staged changes
aicommit
# Stage and commit all changes
aicommit --add
# Stage all changes, commit, and push
aicommit --add --push
# Stage all changes, pull before commit, and push after
aicommit --add --pull --push
The watch mode allows you to automatically commit changes at specified intervals. This is useful for:
- Automatic backups of your work
- Maintaining a detailed history of changes
- Not forgetting to commit your changes
aicommit --watch 1m # Check and commit changes every minute
aicommit --watch 30s # Check every 30 seconds
aicommit --watch 2h # Check every 2 hours
You can add a delay after the last edit before committing. This helps avoid creating commits while you're still actively editing files:
aicommit --watch 1m --wait-for-edit 30s # Check every minute, but wait 30s after last edit
s
: secondsm
: minutesh
: hours
You can combine watch mode with other flags:
# Watch with auto-push
aicommit --watch 1m --push
# Watch with version increment
aicommit --watch 1m --add --version-file version --version-iterate
# Interactive mode with watch
aicommit --watch 1m --dry-run
- Use shorter intervals (30s-1m) for active development sessions
- Use longer intervals (5m-15m) for longer coding sessions
- Add
--wait-for-edit
when you want to avoid partial commits - Use
Ctrl+C
to stop watching
This project is licensed under the MIT License - see the LICENSE file for details.