Configuring Gai

gai stores its configuration options in a config.toml found in your Operating Systems' user configuration directory.

If an existing config doesn't exist, gai will create one with default values on the first run.


AI Options

Configure AI provider settings, prompts, and behavior rules.

Provider Settings

provider - Select your AI provider

providers - Provider-specific configuration

[ai.providers.Gemini]
model = "gemini-2.5-flash"
max_tokens = 5000

[ai.providers.OpenAI]
model = "gpt-5"
max_tokens = 5000

[ai.providers.Claude]
model = "claude-3-5-haiku"
max_tokens = 5000

Prompt Options

system_prompt - Custom system prompt override

commit_convention - Custom commit convention override

include_convention - Include commit convention in prompt

hint - Additional hinting for LLMs

Context Options

include_file_tree - Include repository file tree (.gitignore respected)

include_git_status - Include git status output

include_untracked - Include untracked files

files_to_truncate - Files to truncate before sending

AI Response Rules

group_related_files - Group related files by type

no_file_splitting - Keep files in single commits

separate_by_purpose - Separate commits by purpose

verbose_descriptions - Use verbose commit descriptions

exclude_extension_in_scope - Exclude file extensions in scope

allow_empty_scope - Allow empty scope field

allow_body - Allow commit message bodies

max_header_length - Maximum commit header length

max_body_length - Maximum body line length

Gai Options

Git-specific settings for gai.

Staging Behavior

only_staged - Only generate commits for staged changes

stage_hunks - Apply changes as hunks

Commit Message Format

capitalize_prefix - Capitalize commit type prefix

include_scope - Include scope in commits

include_breaking - Mark breaking changes

breaking_symbol - Custom breaking change symbol

TUI Options

auto_request - Send request on launch

Full Example Configuration

[ai]
provider = "Gai"
include_convention = false
include_file_tree = true
include_git_status = true
include_untracked = true
files_to_truncate = []

[ai.providers.OpenAI]
model = "gpt-5-nano"
max_tokens = 5000

[ai.providers.Gemini]
model = "gemini-2.5-flash-lite"
max_tokens = 5000

[ai.providers.Claude]
model = "claude-3-5-haiku"
max_tokens = 5000

[ai.providers.Gai]
model = "gemini-2.5-flash"
max_tokens = 5000

[ai.rules]
group_related_files = true
no_file_splitting = true
separate_by_purpose = true
verbose_descriptions = true
exclude_extension_in_scope = true
allow_empty_scope = true
max_header_length = 52
allow_body = false
max_body_length = 72

[gai]
only_staged = false
stage_hunks = false

[gai.commit_config]
capitalize_prefix = false
include_scope = true
include_breaking = true

[tui]
auto_request = false

CLI Usage

Global Flags

These flags work with any command:

Commands

gai auth - Authenticate with the Gai provider

gai auth login   # Login via GitHub OAuth
gai auth status  # Check authentication status and request limits
gai auth logout  # Clear stored authentication token

gai status - Display repository status

gai status          # Show repository status
gai status -v       # Show verbose status with prompt and diffs

gai commit - Generate and apply commits

gai commit                    # Interactive commit generation
gai commit -y                 # Skip confirmation, apply immediately
gai commit -s                 # Only generate for staged changes
gai commit -H                 # Stage changes as hunks
gai commit -f                 # Stage changes as files (override -H)
gai commit -c KEY=VALUE       # Override config options for this commit

Environment Variables

Configure API keys using environment variables or a .env file:

OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key
GEMINI_API_KEY=your_gemini_key