Why GitHub Copilot?
Use Existing Subscription
Already have Copilot? No need for separate API keys
Multiple Models
Access Claude Sonnet, GPT-5, o4-mini, and more
One-Click Authentication
OAuth device flow - no API keys to manage
Higher Rate Limits
Copilot subscriptions include generous usage limits
Requirements
You need an active GitHub Copilot subscription:- GitHub Copilot Individual ($10/month)
- GitHub Copilot Business (through your organization)
- GitHub Copilot Enterprise (advanced features)
Students, teachers, and open source maintainers can get Copilot for free through GitHub Education.
Setup with Device Code OAuth
GitHub Copilot uses the device code OAuth flow - a secure authentication method designed for devices without web browsers.Start authentication
- Open Settings → AI Connections
- Click Add Connection
- Select GitHub Copilot (OAuth)
- Click Authenticate with GitHub
Get device code
Craft Agents will display a device code and verification URL:Click the link to open GitHub in your browser (or copy the code manually).
Enter code on GitHub
- Go to github.com/login/device
- Enter the user code shown in Craft Agents
- Click Continue
- Review the permissions:
- Access to Copilot API
- Model selection
- Usage analytics
- Click Authorize
Implementation Details
The device code flow is implemented using the Pi SDK’s native GitHub Copilot support:apps/electron/src/main/ipc.ts:1946-2019
Available Models
GitHub Copilot provides access to multiple LLM providers:packages/shared/src/config/llm-connections.ts:415
Model availability depends on your Copilot subscription tier and GitHub’s model rollout. Check the Copilot models documentation for the latest list.
Pricing
GitHub Copilot uses a flat subscription fee - no per-token billing:| Plan | Price | Models Included |
|---|---|---|
| Individual | $10/month | All supported models |
| Business | $19/user/month | All models + admin controls |
| Enterprise | Custom | All models + advanced features |
Using Pi Unified API
GitHub Copilot connections use the Pi unified LLM API with thegithub-copilot auth provider:
- Fetches available models from the Copilot API
- Handles token refresh
- Routes requests to the correct model endpoint
packages/shared/src/agent/pi-agent.ts:351-533
Troubleshooting
No active Copilot subscription
No active Copilot subscription
Error:
Access denied. Check your API key permissions.Solutions:- Verify you have an active Copilot subscription at github.com/settings/copilot
- If using Copilot through an organization, ensure your org admin has enabled Copilot for your account
- Check that your GitHub account is in good standing (no payment issues)
Device code expired
Device code expired
Error:
OAuth state expired (older than 10 minutes). Please try again.Device codes expire after 15 minutes. Click Cancel in Craft Agents and restart the authentication flow.Rate limits
Rate limits
Error:
Rate limited or quota exceeded. Try again later.GitHub Copilot enforces fair use limits:- Too many requests in a short time
- Unusual usage patterns
Token refresh failed
Token refresh failed
Problem: Connection works initially but stops after a few hours.OAuth tokens expire and must be refreshed. If refresh fails:
- Go to Settings → AI Connections
- Click the ⋮ menu next to your Copilot connection
- Select Sign out
- Re-authenticate using the device code flow
Craft Agents automatically refreshes tokens when they expire. Manual re-authentication is rarely needed.
Model not available
Model not available
Error:
Model not found. Check the connection configuration.Some models may not be available on all Copilot tiers:- Claude Sonnet 4.6 requires Copilot Individual or higher
- GPT-5 may require special access
- Try switching to
claude-sonnet-4.6orgpt-4o(most widely available)
Signing Out
To revoke Craft Agents’ access to your GitHub account:Sign out in Craft Agents
- Open Settings → AI Connections
- Click the ⋮ menu next to your Copilot connection
- Select Sign out
Revoke on GitHub (optional)
To fully revoke access:
- Go to github.com/settings/applications
- Find GitHub Copilot in the list
- Click Revoke
Copilot CLI Integration
Craft Agents uses the native Copilot CLI (if installed) for improved model detection:packages/shared/src/agent/backend/internal/runtime-resolver.ts:90-99
The CLI is bundled with Craft Agents for macOS and Windows. Linux users can install it separately:
The Copilot CLI is optional. Craft Agents works without it, but model detection may be slower.
Comparing Copilot to Direct API Keys
| Feature | GitHub Copilot | Anthropic API | OpenAI API |
|---|---|---|---|
| Cost | $10/month (flat) | Pay-per-use | Pay-per-use |
| Models | Claude + GPT + more | Claude only | GPT only |
| Setup | OAuth (easy) | API key | API key |
| Rate limits | Fair use | Tier-based | Tier-based |
| Billing | Monthly subscription | Per-token | Per-token |
Next Steps
Add More Providers
Connect to OpenRouter, Ollama, or custom endpoints
Configure Permissions
Set up read-only or auto-approve modes