Skip to content

Configuration

gitai uses LiteLLM model names and supports Gemini, OpenAI, and Anthropic.

Interactive Setup

Run:

gitai setup

The setup flow prompts for a provider, securely asks for the API key, offers a searchable list of known chat models for that provider, validates the selected model and key, and saves the configuration if validation succeeds.

Provider-specific examples:

gitai setup --provider gemini
gitai setup --provider openai --model openai/gpt-5
gitai setup --provider anthropic

Use --skip-validation only when you need to save configuration while offline or when a provider endpoint is temporarily unavailable.

Saved Config

The setup command writes ~/.gitai/config.json with owner-only permissions where the operating system supports them.

{
  "default_provider": "gemini",
  "providers": {
    "gemini": {
      "api_key": "...",
      "model": "gemini/gemini-2.5-flash"
    }
  }
}

Do not commit this file.

Environment Variables

Environment variables take precedence over saved config:

export GEMINI_API_KEY=...
export OPENAI_API_KEY=...
export ANTHROPIC_API_KEY=...

For Gemini, GOOGLE_API_KEY is also accepted. Use .env.example as a template for local development, and keep real .env files untracked.