Skip to content

Connect GitHub Copilot

Estimated time: 5-10 minutes

If you already have a GitHub Copilot subscription (Individual $10/month or Enterprise), you can reuse this subscription in OpenCode to access models like GPT-4o, Claude, etc., without purchasing additional API.

Who is this for?

  • Users with existing GitHub Copilot subscription
  • Users who don't want to purchase OpenAI/Anthropic API separately
  • Users who want to reuse Copilot models in terminal

If you don't have a Copilot subscription, skip this guide and check other connection tutorials.


What you'll be able to do

  • Connect GitHub Copilot in OpenCode
  • Use models provided by Copilot (GPT-4o, Claude, etc.)
  • Send your first message and receive a response

🎒 Before you start

  • [ ] Completed 1.2 Installation, able to run opencode
  • [ ] Have a GitHub Copilot subscription (Individual or Enterprise)
  • [ ] Able to access github.com

Follow along

Step 1: Verify your Copilot subscription

Visit GitHub settings page to confirm:

https://github.com/settings/copilot

You should see a status like this:

GitHub Copilot
Status: Active

If it shows not subscribed, you need to subscribe to GitHub Copilot first.


Step 2: Start connection in OpenCode

Launch OpenCode:

bash
opencode

In the input box, type:

/connect

Search for GitHub Copilot in the provider list and select it.


Step 3: Complete OAuth authorization

After selecting GitHub Copilot, OpenCode will display an authorization link:

Please visit: https://github.com/login/device
And enter code: XXXX-XXXX

Steps:

  1. Open browser and visit https://github.com/login/device
  2. Enter the device code shown on screen (e.g., XXXX-XXXX)
  3. Click "Authorize" to authorize OpenCode

Auto-open browser

If your terminal supports it, OpenCode will automatically open the browser. If not, manually copy the link.

After successful authorization, OpenCode will display:

✓ Provider added successfully!

Step 4: Select model

After successful connection, type:

/models

You'll see models provided by GitHub Copilot:

ModelDescription
gpt-4oRecommended, flagship multimodal model
gpt-4o-miniFast, low cost
claude-sonnet-4-5Claude latest balanced version
claude-3-5-haikuClaude fast version
o1Enhanced reasoning model
o1-miniFast reasoning

Select a model to start the conversation.

Some models require Pro+ subscription

Advanced models like o1, claude-sonnet-4-5 may require GitHub Copilot Pro+ subscription. With a regular subscription, you may only have access to some models.


Step 5: Send first message (verify success)

In the input box, type:

Hello, please introduce yourself

If you receive a response, the connection is successful.


Checklist ✅

  • [ ] Can see Copilot models in /models
  • [ ] Can receive AI response when sending message
  • [ ] No errors (like unauthorized / subscription required)

Common issues

IssueCauseSolution
unauthorizedOAuth authorization failed or expiredRe-run /connect and select GitHub Copilot
subscription requiredNo Copilot subscriptionSubscribe to GitHub Copilot first
Can't find a modelSubscription tier too lowUpgrade to Pro+ or use other models
Authorization page shows errorDevice code expiredRe-run /connect, complete authorization within 5 minutes
Shows reauthenticateToken expiredRe-authorize

Re-authorization

If Token expires or authorization has issues, you can re-authenticate using:

Method 1: Reconnect in TUI

/connect

Select GitHub Copilot and follow prompts to re-authorize.

Method 2: Terminal command

bash
opencode auth login
# Select GitHub Copilot

Next steps

Need help?

Stuck during configuration? Join the community and connect with 2000+ fellow learners for real-time Q&A.