4.0 KiB
| summary | read_when | |||
|---|---|---|---|---|
| Use GitHub Copilot CLI as a text-only fallback backend |
|
GitHub Copilot CLI
GitHub Copilot CLI (copilot) is GitHub's terminal-based AI assistant. Moltbot can use it as a
CLI backend for text-only fallback when API providers are unavailable.
Prerequisites
- GitHub account (free tier works for
gpt-4.1) - GitHub CLI (
gh) authenticated with your GitHub account
Note: gpt-4.1 is available on the free GitHub tier. Other models like gpt-4o, claude-sonnet-4-5,
and claude-opus-4-5 require a paid GitHub Copilot subscription.
Installation
Install the Copilot CLI via npm:
npm install -g @github/copilot
Or via Homebrew:
brew install github/copilot/copilot
Or use the gh copilot extension:
gh extension install github/gh-copilot
Verify installation:
copilot --help
# or
gh copilot --help
Quick start
Use Copilot CLI directly with Moltbot:
moltbot agent --message "hi" --model copilot-cli/gpt-4.1
Configuration
Minimal config (custom command path)
If your gateway runs under launchd/systemd with a minimal PATH, specify the full path:
{
agents: {
defaults: {
cliBackends: {
"copilot-cli": {
command: "/opt/homebrew/bin/copilot"
}
}
}
}
}
Using as a fallback
Add copilot-cli to your fallback list so it only runs when primary models fail:
{
agents: {
defaults: {
model: {
primary: "github-copilot/gpt-4.1",
fallbacks: [
"copilot-cli/gpt-4.1"
]
},
models: {
"github-copilot/gpt-4.1": { alias: "Copilot" },
"copilot-cli/gpt-4.1": {}
}
}
}
}
Supported models
Copilot CLI supports these models (availability depends on your GitHub plan):
Free tier (GitHub Free):
gpt-4.1← recommended defaultgpt-4.1-mini
Paid tier (GitHub Copilot subscription):
gpt-4ogpt-4-turboclaude-sonnet-4-5claude-opus-4-5
Example model refs:
copilot-cli/gpt-4.1
copilot-cli/gpt-4.1-mini
copilot-cli/gpt-4o
copilot-cli/claude-sonnet-4-5
Authentication
Copilot CLI uses GitHub CLI authentication. Ensure you're logged in:
gh auth status
If not logged in:
gh auth login
Limitations
- Text output only: Copilot CLI does not support JSON output, so responses are plain text.
- Tools disabled: CLI backends never receive tool calls. The CLI may still run its own agent tooling internally.
- No streaming: CLI output is collected then returned.
- Session resume: Uses
--resumeflag with session ID when available.
Differences from the API provider
| Aspect | github-copilot (API) |
copilot-cli (CLI backend) |
|---|---|---|
| Output format | JSON (structured) | Text only |
| Tools | Moltbot tools work | Tools disabled |
| Streaming | Supported | Not supported |
| Auth | Device flow / token exchange | GitHub CLI (gh auth) |
Choose the API provider (github-copilot) for full functionality. Use copilot-cli as a
fallback when you want "always works" text responses.
Troubleshooting
CLI not found
Set the full command path in your config:
{
agents: {
defaults: {
cliBackends: {
"copilot-cli": {
command: "/usr/local/bin/copilot"
}
}
}
}
}
Authentication errors
Re-authenticate with GitHub CLI:
gh auth login
gh auth status
Model not available
Model availability depends on your GitHub Copilot plan. Try a different model:
moltbot agent --message "hi" --model copilot-cli/gpt-4.1