Use LLM to create git commit messages
Project description
cai
cai is a Git extension that automates the creation of commit messages.
Simply run git cai to generate a meaningful, context-aware commit message based on the changes in your repository.
cai uses a Large Language Model (LLM) to analyse diffs and new files, producing concise and informative commit messages.
Currently supported providers:
- OpenAI
- Gemini
- Anthropic
- Groq
- xAI
- Mistral
- DeepSeek
Prerequisites
- Python 3.10 or higher
- pipx
- An API key for at least one of the following providers:
- OpenAI
- Gemini (free tier available)
- Anthropic
- Groq (free tier available)
- xAI
- Mistral
- DeepSeek
Features
- Automatically detects added, modified, and deleted files
- Generates meaningful, context-aware commit messages using an LLM
- Seamless integration with Git
- Supports multiple LLM providers and models
- Global configuration with per-repository overrides
- Repository-specific language, style, and model selection
- Optional commit squashing with automatic summary generation
Installation
Install cai using pipx:
pipx install git-cai-cli
Ensure that pipx binaries are available in your PATH:
pipx ensurepath
Restart your shell after installation.
If you are running Arch Linux or an Arch-based distribution such as EndeavourOS, CachyOS, etc., you can install the package from the AUR using a package manager like Paru.
paru -S cai
Usage
Once installed, cai works like a standard Git command:
git cai
cai uses the output of git diff to generate a commit message.
The generated message is opened in your configured Git editor, allowing you to review or edit it before committing.
In short: it behaves like git commit, but the commit message is pre-filled.
Ignoring files
To exclude specific files or directories from being considered when generating commit messages, create a .caiignore file in the root of your repository.
- Files listed in
.gitignoreare always excluded .caiignoreis intended for tracked files that should not influence commit messages
The syntax is identical to .gitignore.
Configuration
On first execution, cai automatically creates two configuration files:
-
Global configuration:
~/.config/cai/cai_config.yml -
API tokens:
~/.config/cai/tokens.yml
Don't be scared the first run will show an error. It only misses a token.
Add your provider API keys to tokens.yml. Once configured, cai will reuse them automatically.
Set your preferred LLM in cai_config.yml (Groq by default).
Repository-specific configuration
Each repository can be configured independently.
If a cai_config.yml file exists in the root of a repository, cai will use it instead of the global configuration.
This allows different projects to use different providers, models, languages, and styles.
Examples of per-repository customization:
- Different LLM providers or models
- Different commit message languages
- Different writing styles or tones
- Emojis enabled or disabled per project
To create a repository-specific configuration:
cp ~/.config/cai/cai_config.yml .
Modify the copied file as needed. As an alternative execute:
git cai -g
Available configuration options
default– default LLM providermodel– model to use for the selected provider
(note: not all models may be compatible)temperature– controls how creative the generated messages arelanguage– language used for commit messagesstyle– tone or style of the commit messageemoji– enable or disable emojisload_tokens_from– path to the file where API tokens are stored
CLI
In addition to git cai, the following options are available:
-h--help– show help and available commands-a,--all– stage all tracked modified and deleted files-c,--crazy– Trust the LLM and commit without checking-d,--debug– enable debug logging-g,--generate-config– generate the defaultgit_config.ymlin the current directory-l,--list– list available languages and styles-s,--squash– squash commits on the current branch and summarize them-u,--update– check for updates-v,--version– show the installed version
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
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 git_cai_cli-0.7.5.tar.gz.
File metadata
- Download URL: git_cai_cli-0.7.5.tar.gz
- Upload date:
- Size: 108.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f0ad93cfb7b485453bab0e57bf2e76f6ddc32a0814fb0c194dc62615c720666
|
|
| MD5 |
7a53c8e0fe3daa0a36199ec50af35c17
|
|
| BLAKE2b-256 |
e23454038f457b9acf35d4758120541ff7cab0b3bd52367a46024f33064b45c4
|
Provenance
The following attestation bundles were made for git_cai_cli-0.7.5.tar.gz:
Publisher:
release.yml on thorstenfoltz/cai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_cai_cli-0.7.5.tar.gz -
Subject digest:
9f0ad93cfb7b485453bab0e57bf2e76f6ddc32a0814fb0c194dc62615c720666 - Sigstore transparency entry: 939774161
- Sigstore integration time:
-
Permalink:
thorstenfoltz/cai@a6af5c1a7dd6290642ed31e1ec7beeffc515ce71 -
Branch / Tag:
refs/tags/0.7.5 - Owner: https://github.com/thorstenfoltz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a6af5c1a7dd6290642ed31e1ec7beeffc515ce71 -
Trigger Event:
release
-
Statement type:
File details
Details for the file git_cai_cli-0.7.5-py3-none-any.whl.
File metadata
- Download URL: git_cai_cli-0.7.5-py3-none-any.whl
- Upload date:
- Size: 28.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c239ebb4f4cfc6dbe5efa27711d1ee74dd70e754f0f60f5e6f5afceea0923559
|
|
| MD5 |
95869ac7d4461f1f2c6e9302378672f9
|
|
| BLAKE2b-256 |
913e859412a03f0d247edff9f95d655a93e9f7d256e2cb715fc27a12f41c51ba
|
Provenance
The following attestation bundles were made for git_cai_cli-0.7.5-py3-none-any.whl:
Publisher:
release.yml on thorstenfoltz/cai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_cai_cli-0.7.5-py3-none-any.whl -
Subject digest:
c239ebb4f4cfc6dbe5efa27711d1ee74dd70e754f0f60f5e6f5afceea0923559 - Sigstore transparency entry: 939774172
- Sigstore integration time:
-
Permalink:
thorstenfoltz/cai@a6af5c1a7dd6290642ed31e1ec7beeffc515ce71 -
Branch / Tag:
refs/tags/0.7.5 - Owner: https://github.com/thorstenfoltz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a6af5c1a7dd6290642ed31e1ec7beeffc515ce71 -
Trigger Event:
release
-
Statement type: