Before configuring, please review:
- Configuration Guide - How to configure providers
- General Settings - Common settings applicable to all providers
GitHub Models is separate from GitHub Copilot UI features.
- GitHub Copilot: IDE/chat coding assistant experience
- GitHub Models: REST API access to hosted models via
https://models.github.ai
aicommit2 integrates with the official GitHub Models API, not private Copilot endpoints.
aicommit2 github-loginThis command:
- Authenticates with GitHub CLI
- Stores token in
GITHUB_MODELS.key - Verifies GitHub Models access
- Create a GitHub Personal Access Token (PAT)
- Grant permission:
models: read - Configure token:
aicommit2 github-login --token github_pat_xxxxxxxxxxxxxxxxxxxx
# or
aicommit2 config set GITHUB_MODELS.key="github_pat_xxxxxxxxxxxxxxxxxxxx"Create a token from GitHub settings:
- Fine-grained token (recommended): github.com/settings/personal-access-tokens/new
- Classic token page: github.com/settings/tokens
You can find additional information at the link: GitHub personal access tokens documentation.
Token must have models: read access, otherwise requests typically fail with 403.
models: read is for GitHub Models API usage. It is different from Copilot CLI/SDK token requirements (Copilot Requests).
Supported token prefixes in aicommit2 include:
github_pat_...ghp_...gho_...ghu_...ghs_...ghr_...
- GitHub CLI installed
- Browser access for web login
Install GitHub CLI:
# macOS
brew install gh
# Windows (winget)
winget install GitHub.cli
# Windows (choco)
choco install gh
# Linux (Debian/Ubuntu)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install ghGITHUB_MODELS.model must use this format:
publisher/model
Examples:
openai/gpt-4o-miniopenai/gpt-5openai/gpt-5-chatmeta/llama-3.3-70b-instruct
Legacy short IDs like gpt-4o-mini are invalid for this provider flow in aicommit2.
Model access depends on your GitHub Copilot plan and request allowance.
As of April 2, 2026 (based on current GitHub docs):
- Copilot Free: up to
2,000inline suggestion requests and up to50premium requests/month. Model choice is limited. - Paid plans / Copilot Student: unlimited inline suggestions and unlimited chat interactions for included models (
GPT-5 mini,GPT-4.1,GPT-4o), with additional premium request allowances for premium models. - GitHub explicitly notes model availability can vary by plan and can change over time.
- Additional premium request purchases are not available on Copilot Free.
You can find additional information at the link: Plans for GitHub Copilot and Requests in GitHub Copilot.
Even if a model appears available in Copilot UI, it may still be unavailable for your token on models.github.ai.
For API usage with aicommit2, you may see:
400 unavailable_model(model not currently usable for your token in API context)403(permission/entitlement issue)429(rate limiting)
When in doubt, run a live check with your own token before setting a default model.
The following results were validated with a real GITHUB_TOKEN on 2026-04-02 using:
X-GitHub-Api-Version: 2026-03-10- catalog probe + throttled dry-run commit generation
- Total probed models:
41 200 OK:29400:7(unavailable_model/unknown_model)403:5
- Total dry-run models:
29 OK (generated):23FAIL (no_valid_commit_message):6
- OpenAI:
openai/gpt-4.1,openai/gpt-4.1-mini,openai/gpt-4.1-nano,openai/gpt-4o,openai/gpt-4o-mini - Cohere:
cohere/cohere-command-a,cohere/cohere-command-r-08-2024,cohere/cohere-command-r-plus-08-2024 - DeepSeek:
deepseek/deepseek-v3-0324 - Meta:
meta/llama-3.2-11b-vision-instruct,meta/llama-3.2-90b-vision-instruct,meta/llama-3.3-70b-instruct,meta/llama-4-maverick-17b-128e-instruct-fp8,meta/llama-4-scout-17b-16e-instruct,meta/meta-llama-3.1-405b-instruct,meta/meta-llama-3.1-8b-instruct - Mistral AI:
mistral-ai/codestral-2501,mistral-ai/ministral-3b,mistral-ai/mistral-medium-2505,mistral-ai/mistral-small-2503 - xAI:
xai/grok-3 - Microsoft:
microsoft/phi-4,microsoft/phi-4-multimodal-instruct
deepseek/deepseek-r1deepseek/deepseek-r1-0528xai/grok-3-minimicrosoft/phi-4-mini-instructmicrosoft/phi-4-mini-reasoningmicrosoft/phi-4-reasoning
- This snapshot is token-specific and time-specific.
- A model can appear in
catalog/modelsand still fail at inference time for your token (unavailable_model,403, etc.). - A model can return
200but still fail aicommit2 commit parsing if it does not return valid commit JSON. - This is currently the most reliable way to find working models for your account: probe + throttled dry-run.
- Fetch catalog with
X-GitHub-Api-Version: 2026-03-10. - Probe only text-generation models with a delay between requests (for example,
sleep 2). - Keep only models with
HTTP 200. - Run commit
--dry-runchecks sequentially with throttling (for example,sleep 12) and retry on429.
Example catalog command:
curl -sSL \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://models.github.ai/catalog/models > catalog.jsonaicommit2 github-login
aicommit2 config set GITHUB_MODELS.model="openai/gpt-5"
git add .
aicommit2aicommit2 config set \
GITHUB_MODELS.key="github_pat_xxxxxxxxxxxxxxxxxxxx" \
GITHUB_MODELS.model="openai/gpt-5" \
GITHUB_MODELS.temperature=0.7 \
GITHUB_MODELS.maxTokens=1024 \
GITHUB_MODELS.locale="en" \
GITHUB_MODELS.generate=3 \
GITHUB_MODELS.topP=0.95| Setting | Description | Default |
|---|---|---|
key |
GitHub token | - |
model |
GitHub Models model ID (publisher/model) |
openai/gpt-4o-mini |
GitHub catalog changes over time. Use live discovery instead of static hardcoded lists.
# Install extension once
gh extension install https://github.com/github/gh-models
# Show available models
gh models list
# Optional: raw catalog endpoint
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://models.github.ai/catalog/modelsYou can find additional information at the link: GitHub Models inference REST API.
aicommit2 uses GitHub API version header:
X-GitHub-Api-Version: 2026-03-10
Token is invalid/expired:
aicommit2 github-loginToken lacks models: read permission.
Model unavailable for your account or incorrect model ID. Check gh models list.
Model ID format is invalid. Use publisher/model (example: openai/gpt-4o-mini).
You can find additional information at the link: