Skip to main content

🤖 commity

PyPI version Python versions License

English | 简体中文

Generate intelligent Git commit messages with AI. Supports Conventional Commits, emoji, and multiple LLM providers like OpenAI, Ollama, and Gemini.

🤔 What is Commity?

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

🔧 Installation

Install with pip:

pip install commity

Or install with uv:

uv tool install commity

⚙️ Configuration

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, NVIDIA.

Gemini, OpenAI, OpenRouter, and NVIDIA always require an API key. Commity aborts early if those keys are missing so you get fast feedback before hitting the network.

✨ Method 1: Specify Model Parameters via Command-line

OpenAI

commity --provider openai --model gpt-3.5-turbo --api_key <your-api-key>

Ollama

commity --provider ollama --model llama2 --base_url http://localhost:11434

Gemini

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 \

OpenRouter

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> \

NVIDIA

commity --provider nvidia --model nvidia/llama-3.1-70b-instruct --api_key <your-nvidia-api-key>

or

commity \
--provider nvidia \
--model nvidia/llama-3.1-nemotron-70b-instruct \
--api_key <your-nvidia-api-key> \

🌱 Method 2: Set Environment Variables as Defaults

You can add the following to your .bashrc, .zshrc, or .env file:

OpenAI

export COMMITY_PROVIDER=openai
export COMMITY_MODEL=gpt-3.5-turbo
export COMMITY_API_KEY=your-api-key

Ollama

export COMMITY_PROVIDER=ollama
export COMMITY_MODEL=llama2
export COMMITY_BASE_URL=http://localhost:11434

Gemini

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

OpenRouter

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

NVIDIA

export COMMITY_PROVIDER=nvidia
export COMMITY_MODEL=nvidia/llama-3.1-70b-instruct
export COMMITY_API_KEY=your-nvidia-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.

  1. Create the directory:

    mkdir -p ~/.commity
    
  2. Create and edit the config.json file:

    touch ~/.commity/config.json
    
  3. 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"
    }
    

    Or using NVIDIA:

    {
      "PROVIDER": "nvidia",
      "MODEL": "nvidia/llama-3.1-70b-instruct",
      "API_KEY": "your-nvidia-api-key"
    }
    

🚀 Usage

# Run
commity

# View help
commity --help

# Use Chinese (--lang is kept as an alias)
commity --language 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

# Use NVIDIA with specific model
commity --provider nvidia --model nvidia/llama-3.1-70b-instruct --api_key <your-nvidia-api-key>

# Use NVIDIA with emoji support
commity --provider nvidia --model nvidia/llama-3.1-nemotron-70b-instruct --api_key <your-nvidia-api-key> --emoji

# Skip interactive confirmation and commit immediately
commity --confirm n

# Run via Python module entry point
python -m commity --language zh --emoji

Metadata

Release files for commity 0.1.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for commity 0.1.19
File Size Uploaded Provenance Actions
commity-0.1.19.tar.gz 94.2 kB Without provenance Details for commity-0.1.19.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for commity 0.1.19
File Interpreter ABI Platform Actions
commity-0.1.19-py3-none-any.whl Python 3 none any Details for commity-0.1.19-py3-none-any.whl

Total release size: 129.7 kB

Release files / commity-0.1.19.tar.gz

Download URL commity-0.1.19.tar.gz
Size 94.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cf644a0574c4b2933ecb265fad4893527d4c6e5a714f87207cdc37f2fa3a76d5
BLAKE2b-256 checksum
How to use checksums
564ff2773425caa33351d79c84983407df0b2683451daa2a83c85b764de131b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / commity-0.1.19-py3-none-any.whl

Download URL commity-0.1.19-py3-none-any.whl
Size 35.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8680f0d8eb192a2feb6d90697ce795dab7bf5d6874d7e32214285054dbd00d0
BLAKE2b-256 checksum
How to use checksums
5f921b2ea4b2c783ba4c6e49f1c971a114451812f983ed95b8f1ef9d885a9214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Security for commity 0.1.19

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page