appleboy/CodeGPT
A CLI written in Go language that writes git commit messages or do a code review brief for you using ChatGPT AI (gpt-4.1, gpt-4o model) and automatically installs a git prepare-commit-msg hook.
CodeGPT – AI‑powered commit‑message and code‑review helper
What it is – A command‑line tool written in Go that talks to large‑language‑model APIs (OpenAI, Azure OpenAI, Gemini, Anthropic, Ollama, Groq, OpenRouter, LiteLLM proxy). It uses the model to:
- Generate conventional‑commit messages from the current
git diff. - Produce short code‑review summaries.
- Translate the generated text into English, Traditional Chinese, Simplified Chinese or Japanese.
- Stream the model’s output so you see tokens appear in real time.
Why you might care – Writing good commit messages and doing quick code‑review checks are repetitive tasks. CodeGPT automates them by calling a LLM, letting you keep a clean commit history without leaving the terminal.
Key features (as listed in the README)
- Supports many back‑ends: OpenAI (gpt‑4o, gpt‑4, gpt‑5), Azure OpenAI, Gemini, Anthropic, Ollama, Groq, OpenRouter, LiteLLM proxy.
- Generates messages that follow the Conventional Commits spec.
- Installs a
prepare‑commit‑msgGit hook automatically. - Customizable diff context lines (default 3) and file‑exclusion patterns.
- Built‑in language translation (
en,zh‑tw,zh‑cn,ja). - SOCKS or HTTP proxy support.
- Brief code‑review generation.
- Streaming output for live token display.
- Prompt‑template system – you can edit the templates used for commits, reviews, etc.
Installation options
| Platform | Method |
|---|---|
| macOS | brew tap appleboy/tap && brew install codegpt |
| Windows | choco install codegpt |
| Linux / any OS | Run the provided install script (bash <(curl -sSL https://raw.githubusercontent.com/appleboy/CodeGPT/main/install.sh)) or download a pre‑compiled binary from the releases page and place it in $HOME/.config/codegpt/bin (or any directory in $PATH). |
| From source | go install github.com/appleboy/CodeGPT/cmd/codegpt@latest |
| VS Code devcontainer | Add the feature ghcr.io/kvokka/features/codegpt:1 to devcontainer.json. |
The script respects two environment variables:
VERSION– pick a specific release.INSECURE=1– skip SSL verification (useful behind corporate proxies).
Quick start / typical workflow
- Configure an API key – e.g. for OpenAI:
The tool can also fetch keys dynamically with an API‑key helper command (useful with password managers or cloud secret stores).export OPENAI_API_KEY=sk-xxxxxxx # or store via the CLI codegpt config set openai.api_key sk-xxxxxxx - Install the Git hook (once per repository):
codegpt hook install # creates .git/hooks/prepare-commit-msg - Commit as usual – when you run
git commit, the hook calls CodeGPT, which:- runs
git diffon the staged changes, - sends the diff to the selected LLM,
- receives a Conventional‑Commit formatted message and inserts it into the commit editor.
- runs
- Optional code‑review – run:
to get a short summary of the changes.codegpt review
Configuration highlights
- Provider selection –
openai.providercan be set toopenai,azure,gemini,anthropic,litellm, etc. - Model choice –
openai.modeldefaults togpt‑4obut any model supported by the chosen provider can be specified. - Proxy –
openai.proxy(HTTP/HTTPS) oropenai.socksfor SOCKS5. - Prompt folder – defaults to
$HOME/.config/codegpt/prompt; change withcodegpt config set prompt.folder /my/prompt. - Dynamic key helper – set
openai.api_key_helperto a shell command that returns the key; the result is cached for 15 min (configurable). - Output language –
output.lang(en,zh‑tw,zh‑cn,ja).
Example commands
# Generate a commit message (CLI mode, no hook)
codegpt commit
# Review the staged changes
codegpt review
# Show the version
codegpt version
Who might use it?
- Developers who already use Git and want AI‑assisted commit messages without leaving their terminal.
- Teams that enforce Conventional Commits and need a quick way to keep the format consistent.
- Anyone who wants a lightweight, configurable LLM client for on‑the‑fly code summarisation.
License & community
The repository includes CI badges for linting, testing, security scanning and code‑coverage, indicating an actively maintained open‑source project. The README links to a Chinese blog post and a YouTube demo for additional context.
Bottom line – CodeGPT is a practical, Go‑based CLI that plugs LLMs into the Git workflow, automating commit‑message generation and brief code reviews while offering extensive configuration (multiple providers, proxy support, dynamic credential helpers, custom prompts).
Related
- Project
- Project
- Project
- Project
- Project