0x0-git is a standalone CLI that generates AI-powered commit messages from your staged changes. It
auto-detects whether you have the Claude or Codex CLI installed, picks the right model, and
communicates with the 0x0 server’s /completion/text endpoint. It can be installed as a git hook for
automatic suggestions on every commit.
Installation
Requirements
- 0x0 CLI (
0x0) — needed for auto-starting the server (see below) - At least one of these LLM CLI tools:
- Claude Code CLI (
claude) — usesclaude-haiku-4-5-20251001by default - OpenAI Codex CLI (
codex) — useso4-miniby default
- Claude Code CLI (
Usage
Generate a commit message
Install as a git hook
git commit (without -m) automatically generates a message from your staged
diff. The hook is non-destructive: it preserves existing hook content, uses markers for safe
uninstall, and skips generation when a message is already provided (-m, merge, squash, amend).
The hook also respects custom hook paths via core.hooksPath (husky compatible).
Configuration
Configuration is resolved in priority order:| Source | Provider | Model | URL | Auth |
|---|---|---|---|---|
| CLI flags | --provider | --model | — | — |
| Environment | GIT_AI_PROVIDER | GIT_AI_MODEL | GIT_AI_URL | GIT_AI_AUTH |
| Auto-detect | Prefers claude, falls back to codex | Per-provider default | http://localhost:4096 | none |
Environment variables
| Variable | Description |
|---|---|
GIT_AI_PROVIDER | Provider to use: claude or codex |
GIT_AI_MODEL | Model to use (overrides provider default) |
GIT_AI_URL | 0x0 server URL (default: http://localhost:4096) |
GIT_AI_AUTH | Basic auth credentials in username:password format |
Default models
| Provider | Default model |
|---|---|
claude | claude-haiku-4-5-20251001 |
codex | o4-mini |
Commit message format
Generated messages follow the Conventional Commits format:- Types:
feat,fix,refactor,docs,style,test,chore,perf,ci,build - Scope: most relevant module or area (optional)
- Subject line: under 72 characters, imperative mood
- Body: added only when the changes warrant explanation
How it works
- Auto-detects the available provider (
claudeorcodexbinary) - Reads staged changes via
git diff --cached - Builds a prompt with the file list and diff
- Ensures the 0x0 server is running (auto-starts it if needed)
- Sends the prompt to the 0x0 server’s
/completion/textSSE endpoint - Streams the response and outputs the commit message
0x0-git itself has zero
direct LLM dependencies.
Auto-start server
If the 0x0 server is not already running,0x0-git will automatically start it. It looks for the
0x0 binary in your PATH and spawns 0x0 server --port <port> as a detached background process,
then waits up to 15 seconds for it to become available. If 0x0 is not found in PATH, an error is
thrown.
This means you don’t need to manually start the server before running 0x0-git — it handles
everything for you.
See also
- Server — headless HTTP server mode
- Providers — configure LLM providers and models
- CLI Reference —
0x0 servercommand reference