Generate intelligent Git commit messages with AI. Supports Conventional Commits, emoji, and multiple LLM providers like OpenAI, Ollama, and Gemini.
Commity is an open-source, AI-powered Git commit message generation tool. It analyzes your staged code changes and automatically generates commit messages that follow the Conventional Commits specification, and can even add emojis for you!
With a simple commity --emoji
command, you can get a professional and clear commit message like this:
feat(api): ✨ add user authentication endpoint
Install with pip
:
pip install commity
Or install with uv
:
uv tool install commity
commity
supports three configuration methods, with the following priority: Command-line Arguments > Environment
Variables > Configuration File.
Supported model providers are: Gemini
(default), Ollama
, OpenAI
, OpenRouter
.
commity --provider openai --model gpt-3.5-turbo --api_key <your-api-key>
commity --provider ollama --model llama2 --base_url http://localhost:11434
commity --provider gemini --model gemini-2.5-flash --base_url https://generativelanguage.googleapis.com --api_key <your-api-key> --timeout 30
or
commity \
--provider gemini \
--model gemini-2.5-flash \
--base_url https://generativelanguage.googleapis.com \
--api_key <your-api-key> \
--timeout 30 \
commity --provider openrouter --model openai/gpt-3.5-turbo --api_key <your-openrouter-api-key>
or
commity \
--provider openrouter \
--model anthropic/claude-3.5-sonnet \
--api_key <your-openrouter-api-key> \
You can add the following to your .bashrc
, .zshrc
, or .env
file:
export COMMITY_PROVIDER=openai
export COMMITY_MODEL=gpt-3.5-turbo
export COMMITY_API_KEY=your-api-key
export COMMITY_PROVIDER=ollama
export COMMITY_MODEL=llama2
export COMMITY_BASE_URL=http://localhost:11434
export COMMITY_PROVIDER=gemini
export COMMITY_MODEL=gemini-2.5-flash
export COMMITY_BASE_URL=https://generativelanguage.googleapis.com
export COMMITY_API_KEY=your-api-key
export COMMITY_TEMPERATURE=0.5
export COMMITY_PROVIDER=openrouter
export COMMITY_MODEL=openai/gpt-3.5-turbo
export COMMITY_API_KEY=your-openrouter-api-key
export COMMITY_TEMPERATURE=0.5
For easier configuration management, you can create a ~/.commity/config.json
file in your user's home directory.
-
Create the directory:
mkdir -p ~/.commity
-
Create and edit the
config.json
file:touch ~/.commity/config.json
-
Add your configuration to
config.json
, for example:{ "PROVIDER": "ollama", "MODEL": "llama3", "BASE_URL": "http://localhost:11434" }
Or using Gemini:
{ "PROVIDER": "gemini", "MODEL": "gemini-1.5-flash", "BASE_URL": "https://generativelanguage.googleapis.com", "API_KEY": "your-gemini-api-key" }
Or using OpenAI:
{ "PROVIDER": "openai", "MODEL": "gpt-3.5-turbo", "API_KEY": "your-openai-api-key" }
Or using OpenRouter:
{ "PROVIDER": "openrouter", "MODEL": "openai/gpt-3.5-turbo", "API_KEY": "your-openrouter-api-key" }
# Run
commity
# View help
commity --help
# Use Chinese
commity --lang zh
# Include emojis
commity --emoji
# Use OpenRouter with specific model
commity --provider openrouter --model anthropic/claude-3.5-sonnet --api_key <your-openrouter-api-key>
# Use OpenRouter with emoji support
commity --provider openrouter --model openai/gpt-4o --api_key <your-openrouter-api-key> --emoji