VOOZH about

URL: https://deepwiki.com/guanguans/ai-commit/3.4-ai-generators-overview

⇱ AI Generators Overview | guanguans/ai-commit | DeepWiki


Loading...
Menu

AI Generators Overview

This page provides a high-level survey of all AI generators supported by ai-commit: what they are, which category they fall into, how to select one at runtime, and the minimum configuration required for each.

For a deeper look at how generators are implemented internally, see the Generator System Architecture (page 5) and its subpages. For the full set of config keys available per generator, see Generator-Specific Configuration (page 7.4).


Generator Categories

ai-commit supports two categories of generators:

CategoryHow it worksGenerators
API-basedSends the prompt via HTTP to a remote AI APIopenai, openai_chat, moonshot, ernie_bot, ernie_bot_turbo
CLI-basedShells out to a locally installed CLI toolbito_cli, github_copilot_cli, github_models_cli

API-based generators use concrete HTTP client classes and require a valid API key. CLI-based generators use Symfony\Component\Process to invoke an external binary and require that binary to be installed and accessible on $PATH.

Sources: config/ai-commit.php78-219 README.md22-31


Generator Resolution

The GeneratorManager class (app/GeneratorManager.php) resolves a generator by name. It reads the generator configuration block from ai-commit.generators.<name>, converts the driver key to a studly-cased class name, and instantiates it.

Driver name → class name resolution (from createDriver in app/GeneratorManager.php63-77):

"openai" → App\Generators\OpenAIGenerator
"openai_chat" → App\Generators\OpenAIChatGenerator
"moonshot" → App\Generators\MoonshotGenerator
"ernie_bot" → App\Generators\ErnieBotGenerator
"ernie_bot_turbo" → App\Generators\ErnieBotTurboGenerator
"bito_cli" → App\Generators\BitoCliGenerator
"github_copilot_cli" → App\Generators\GithubCopilotCliGenerator
"github_models_cli" → App\Generators\GithubModelsCliGenerator

The string openai is specially handled before studly-casing to produce OpenAI instead of Openai.

Driver resolution diagram:


Sources: app/GeneratorManager.php41-77 app/Commands/CommitCommand.php72-78


Selecting a Generator

There are three ways to specify which generator to use:

1. At the command line (per-run):


2. As the persistent default in global config:


3. In a local config file (.ai-commit.json in the project directory):


The --generator option is defined in CommitCommand::configure() and defaults to the value of generator in config (app/Commands/CommitCommand.php150-156). Tab-completion for generator names is provided by CommitCommand::complete() (app/Commands/CommitCommand.php113-124).

Sources: app/Commands/CommitCommand.php132-190 config/ai-commit.php75


All Generators at a Glance

Relationship between config keys, classes, and external dependencies:


Sources: config/ai-commit.php78-219 app/GeneratorManager.php63-77


API-Based Generators

These generators communicate with a remote HTTP API. All API-based generators inherit from AbstractGenerator (app/Generators/AbstractGenerator.php) and use an HTTP client constructed from their config block.

openai — OpenAIGenerator

Uses the OpenAI Completions endpoint (/v1/completions). This is the older text-completion API. The default model is text-davinci-003.

Minimum configuration:
































Config keyDefaultNotes
api_keysk-...Required
parameters.modeltext-davinci-003Completions model
parameters.max_tokens600
parameters.streamtrueStreaming response

Sources: config/ai-commit.php178-198


openai_chat — OpenAIChatGenerator

Uses the OpenAI Chat Completions endpoint (/v1/chat/completions). This is the default generator. The OpenAIChatGenerator class (app/Generators/OpenAIChatGenerator.php) extends OpenAIGenerator and overrides generate() to send a messages array instead of a plain prompt string.

Minimum configuration:
































Config keyDefaultNotes
api_keysk-...Required
parameters.modelgpt-3.5-turboChat model
parameters.max_tokens600
parameters.streamtrueStreaming response

Sources: config/ai-commit.php199-218 app/Generators/OpenAIChatGenerator.php


moonshot — MoonshotGenerator

Uses the Moonshot AI API, which is compatible with the OpenAI Chat Completions format. Requires a Moonshot API key (sk-...).

Minimum configuration:
































Config keyDefaultNotes
api_keysk-...Required
parameters.modelmoonshot-v1-8kAlso: moonshot-v1-32k, moonshot-v1-128k
parameters.max_tokens600
parameters.streamtrue

Sources: config/ai-commit.php159-177


ernie_bot — ErnieBotGenerator

Uses Baidu's ERNIE-Bot large language model API. Requires both an API key and a secret key to obtain an OAuth access token.

Minimum configuration:
































Config keyDefaultNotes
api_key...Required
secret_key...Required — used for OAuth token exchange
parameters.temperature0.95
parameters.streamtrue

Sources: config/ai-commit.php103-115


ernie_bot_turbo — ErnieBotTurboGenerator

Identical configuration structure to ernie_bot, but targets the ERNIE-Bot-turbo model endpoint, which is faster and less expensive.

Minimum configuration:



























Config keyDefaultNotes
api_key...Required
secret_key...Required
parameters.streamtrue

Sources: config/ai-commit.php116-128


CLI-Based Generators

These generators shell out to an external binary using Symfony\Component\Process. They inherit mustRunProcess and runProcess from AbstractGenerator (app/Generators/AbstractGenerator.php42-70). No HTTP client is used.

bito_cli — BitoCliGenerator

Invokes the Bito CLI (bito binary). The prompt is written to a temporary file, then passed via stdin or a prompt-file argument. The binary path is configurable.

Minimum configuration:

The bito binary must be installed. If it is not on $PATH, specify the path:
































Config keyDefaultNotes
binarybitoPath or name of the bito binary
prompt_filenamebito.promptTemporary prompt file name
parameters.timeout120Process timeout in seconds
options(various)Extra CLI flags passed to bito

Sources: config/ai-commit.php79-102


github_copilot_cli — GithubCopilotCliGenerator

Invokes the GitHub Copilot CLI extension via the gh binary (gh copilot explain or similar subcommand). Requires the gh CLI with the Copilot extension installed and authenticated.

Minimum configuration:

The gh binary must be installed and authenticated. If it is not on $PATH:



























Config keyDefaultNotes
binaryghPath or name of the gh binary
parameters.timeout120Process timeout in seconds
options--hostname: nullExtra CLI flags

Sources: config/ai-commit.php129-141


github_models_cli — GithubModelsCliGenerator

Invokes the GitHub Models CLI extension via the gh binary (gh models run). Requires the gh CLI with the Models extension installed and authenticated.

Minimum configuration:










































Config keyDefaultNotes
binaryghPath or name of the gh binary
modelopenai/gpt-4.1-miniModel identifier passed to gh models run
parameters.timeout120Process timeout in seconds
options['--system-prompt']You are a git commit message generator.System prompt injected as a flag
options['--max-tokens']null
options['--temperature']null

Sources: config/ai-commit.php142-158


Quick Configuration Reference

The table below summarizes the required setup step for each generator.

Config keyGenerator classRequiresRequired env var (alternative)
openaiOpenAIGeneratorOpenAI API keyOPENAI_API_KEY
openai_chatOpenAIChatGeneratorOpenAI API keyOPENAI_API_KEY
moonshotMoonshotGeneratorMoonshot API keyMOONSHOT_API_KEY
ernie_botErnieBotGeneratorBaidu API key + secretERNIE_API_KEY, ERNIE_SECRET_KEY
ernie_bot_turboErnieBotTurboGeneratorBaidu API key + secretERNIE_API_KEY, ERNIE_SECRET_KEY
bito_cliBitoCliGeneratorbito binary installedBITO_CLI_BINARY
github_copilot_cliGithubCopilotCliGeneratorgh + Copilot extGITHUB_COPILOT_CLI_BINARY
github_models_cliGithubModelsCliGeneratorgh + Models extGITHUB_MODELS_CLI_BINARY

API keys can be set via environment variables (read by env() in config/ai-commit.php) or via the config set command to persist them in your global config file.

Sources: config/ai-commit.php78-219 README.md60-72


Default Generator

The default generator is openai_chat, as defined in config/ai-commit.php75:


This can be overridden globally:


GeneratorManager::getDefaultDriver() reads this value from the ai-commit.generator config key (app/GeneratorManager.php41-44).

Sources: config/ai-commit.php74-76 app/GeneratorManager.php41-44