Skip to main content
Grok is xAI’s family of AI models designed for advanced reasoning, code generation, and agentic interactions. GitWhisper supports all Grok model variants for commit message generation and code analysis.

Available Models

GitWhisper supports the following Grok model variants:

Grok 4 Series

  • grok-4 - Most intelligent Grok model with superior reasoning
  • grok-4-heavy - Most powerful variant with extended capabilities
  • grok-4-fast - Efficient reasoning with optimized performance

Specialized Models

  • grok-code-fast-1 - Optimized for agentic coding tasks
  • grok-3 - Advanced reasoning capabilities
  • grok-3-mini - Faster responses with good performance

Production Models

  • grok-2-latest ⭐ (default) - Stable production model
The default model grok-2-latest provides reliable performance for most use cases.

Setup

1

Get API Key

Obtain your Grok API key from xAI’s platform.
2

Save API Key

Save your API key using GitWhisper:
gitwhisper save-key --model grok --key "your-grok-api-key"
Or set it as an environment variable:
export GROK_API_KEY="your-grok-api-key"
3

Use Grok

Generate commits with Grok:
gitwhisper commit --model grok

Usage Examples

# Use default Grok model (grok-2-latest)
gitwhisper commit --model grok
gw commit -m grok

Model Comparison

ModelBest ForReasoningSpeed
grok-4Complex code analysisExcellentMedium
grok-4-heavyDemanding tasksSuperiorSlower
grok-4-fastQuick commitsGoodFast
grok-code-fast-1Coding tasksExcellentFast
grok-2-latestGeneral useGoodFast

Features

Advanced Reasoning

Grok models excel at understanding complex code changes and architectural decisions:
# Grok analyzes your large refactoring
gitwhisper commit --model grok --model-variant grok-4

Agentic Coding Support

The grok-code-fast-1 variant is optimized for agentic coding workflows:
# Use code-specialized model for algorithm commits
gitwhisper commit --model grok --model-variant grok-code-fast-1

Configuration

Set Default Variant

# Set grok-4 as default
gitwhisper set-defaults --model grok --model-variant grok-4

# Set code-specialized as default
gitwhisper set-defaults --model grok --model-variant grok-code-fast-1

API Key Management

Add to your shell configuration:
export GROK_API_KEY="your-grok-api-key"
Save permanently with GitWhisper:
gitwhisper save-key --model grok --key "your-grok-api-key"
This stores the key in ~/.git_whisper.yaml
Pass key directly to the command:
gitwhisper commit --model grok --key "your-grok-api-key"

Best Practices

Use grok-4-fast for regular development work to balance quality and speed, and upgrade to grok-4 for complex analysis tasks.
The grok-4-heavy model is more expensive and slower. Use it only when you need maximum reasoning capability.

Troubleshooting

Ensure your Grok API key is properly configured:
# Check configuration
gitwhisper show-config

# Save key if missing
gitwhisper save-key --model grok --key "your-key"
Verify the variant name is correct:
# List available variants
gitwhisper list-variants --model grok

All Variants

See complete list of Grok model variants

Model Overview

Compare all supported AI models

Configuration

Learn more about API key management

Code Analysis

Use Grok for advanced code analysis

Build docs developers (and LLMs) love