GitHub Copilot Chat
pendingby Marcel Hauri
Bring GitHub Copilot chat directly into your editor, with GitHub Enterprise login support.
GitHub Copilot Chat for Obsidian
Chat with GitHub Copilot directly in Obsidian — with OAuth login, real-time streaming responses, document editing, and vault context.
Features
- Sidebar Chat — persistent named conversations with full message history
- GitHub OAuth — secure Device Flow login (no redirect, no API key required)
- GitHub Enterprise support — authenticate against any
*.ghe.comdomain - Streaming responses — response displayed as plain text once the stream completes
- Conversation management — create, switch, and delete named conversations; history is persisted across sessions
- Subscription-based model list — available models are fetched from the Copilot API and reflect your plan
- Active Document as Context — Copilot sees the content of your currently open note
- Vault note context — include any note by typing
[[note name]]in your message - Custom system prompt — override the built-in system prompt from settings
- Document Actions:
- Append the last response to the end of the active document
- Replace the active document's content with Copilot's response
- Save response as a new note
- Editor Commands:
Explain selectionImprove selectionSummarize current document
Requirements
- An active GitHub Copilot subscription (Individual, Business, or Enterprise)
- Obsidian 1.4.0+
- Node.js 18+ (build only)
- Desktop only (mobile is not supported)
Installation
Manual (Development Build)
# 1. Clone the repository
git clone https://github.com/hauridev/obsidian-github-copilot-plugin.git
cd obsidian-github-copilot-plugin
# 2. Install dependencies
npm install
# 3. Build the plugin
npm run build
# 4. Copy the required files into your vault
mkdir -p /path/to/vault/.obsidian/plugins/obsidian-copilot-chat/
cp main.js manifest.json styles.css /path/to/vault/.obsidian/plugins/obsidian-copilot-chat/
Then in Obsidian: Settings → Community Plugins → Installed Plugins → enable "GitHub Copilot Chat".
Login
GitHub.com
- Open Settings → GitHub Copilot Chat
- Click "Sign in"
- Visit the displayed URL (
https://github.com/login/device) and enter the code - The plugin detects the confirmation automatically — you're done
GitHub Enterprise (*.ghe.com)
- Open Settings → GitHub Copilot Chat
- Under GitHub Enterprise, enter your domain (e.g.
mycompany.ghe.com) - Click "Sign in" and follow the same device flow — OAuth and API calls are routed through your enterprise domain automatically
The GitHub OAuth token is stored securely in Obsidian's plugin data (data.json). Copilot API tokens (short-lived, ~30 min) are held in memory and refreshed automatically. Changing the enterprise domain clears the stored token and requires re-authentication.
Conversations
The plugin saves your chat history across sessions. Each conversation is automatically named after the first message you send.
- Use the dropdown in the chat panel to switch between conversations
- Click + to start a new conversation
- Click the trash icon next to the dropdown to delete the current conversation
- All conversations are persisted in Obsidian's
data.jsonand survive plugin reloads
Models
After signing in, click "Load models" in the Model section of the settings to fetch the models available for your Copilot subscription. The list is cached and updated on each login or manual refresh.
If no models have been fetched yet, the following defaults are shown as a fallback:
| Model | Notes |
|---|---|
gpt-4o | Default, recommended |
gpt-4o-mini | Faster, lighter |
gpt-4 | — |
claude-3.5-sonnet | — |
Actual availability depends on your Copilot plan.
How the OAuth Flow Works
This plugin uses the same Device Flow as GitHub CLI and the VS Code Copilot extension:
- Plugin requests a device code from
{host}/login/device/code - User visits
{host}/login/deviceand enters the displayed code - Plugin polls
{host}/login/oauth/access_tokenuntil authorized - The GitHub token is exchanged for a short-lived Copilot API token via
api.{host}/copilot_internal/v2/token - The Copilot token's
endpoints.apifield determines the API base URL (e.g.https://api.githubcopilot.com) — this ensures enterprise tenants are routed to the correct endpoint - All API requests use Obsidian's built-in
requestUrlinstead offetch, which is required for the plugin to work on desktop
{host} is github.com by default, or your configured enterprise domain (e.g. mycompany.ghe.com).
The Client ID Iv1.b507a08c87ecfe98 is the public VS Code Copilot extension OAuth app, the same one used by community tools for Neovim, Emacs, and JetBrains.
Architecture
main.ts # Plugin entry — registers sidebar view, commands, settings tab
src/
auth/GitHubAuth.ts # Device OAuth flow + Copilot token exchange and caching
api/CopilotClient.ts # OpenAI-compatible HTTP client using Obsidian's requestUrl
views/ChatView.ts # Obsidian ItemView sidebar — chat UI, conversation management, vault wikilinks
settings/SettingsTab.ts # Settings UI and login flow
styles.css # CSS with variables for dark/light mode
Network Access
This plugin makes network requests to the following remote services:
| Service | Endpoint | Purpose |
|---|---|---|
| GitHub OAuth | github.com/login/device/code, github.com/login/oauth/access_token | Authenticate your GitHub account via Device Flow |
| GitHub API | api.github.com/copilot_internal/v2/token | Exchange your GitHub token for a short-lived Copilot API token |
| GitHub Copilot API | api.githubcopilot.com (or enterprise equivalent) | Send chat messages and receive responses from Copilot |
| GitHub Enterprise | *.ghe.com (optional, if configured) | Same as above, routed through your enterprise domain |
No data is sent to any third-party servers. All communication goes directly between your machine and GitHub's servers. No telemetry or analytics are collected by this plugin.
Note: A GitHub account and an active GitHub Copilot subscription are required to use this plugin.
Disclaimer
This plugin uses the internal Copilot API (copilot_internal), which is also used by other community tools (Neovim, Emacs, JetBrains). Use is subject to the GitHub Copilot Terms of Service.
Contributing
Contributions are welcome! Please open issues and pull requests on the GitHub repository:
https://github.com/hauridev/obsidian-github-copilot-plugin
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m 'Add my feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
License
MIT © Marcel Hauri
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.