Fill-in-the-middle (FIM) inline completions ("ghost text") for VSCodium, talking to the GitHub Copilot completion proxy directly — the same approach as copilot.vim / copilot.lua, but as a native VS Code extension.
⚠️ Disclaimer: This project is independent and not affiliated with GitHub. It does not grant any rights to use GitHub, GitHub Copilot, their APIs, endpoints, trademarks, or services. Users are responsible for complying with applicable GitHub terms and maintaining any required Copilot subscription. The Copilot endpoints used here are private / undocumented and may change, be restricted, or stop working without notice.
This project is unmaintained. No support, compatibility updates, security fixes, or response to issues and pull requests should be expected. Forks and independent maintenance are welcome.
- Ghost-text inline completions on every editor (prefix + suffix FIM)
- Automatic token refresh (
401/403→ re-authenticate) - Model auto-detection from the CAPI
/modelsendpoint, withgpt-41-copilotfallback - Configurable token budgets
- VSCodium (or any VS Code-family editor), v1.85+
- bun for building
- A GitHub account with a Copilot subscription
bun install
bun run compile # bundles to out/extension.js
bun run typecheck # optional: TypeScript check
bun test # optional: local smoke tests (SSE parsing etc.)Two ways to load the extension:
- VSIX:
bunx @vscode/vsce package, then Extensions view →...→ Install from VSIX. - Extension Development Host: open this folder in VSCodium and press
F5(debug config is generated automatically by the built-in extension tooling).
| Setting | Default | Description |
|---|---|---|
copilotClient.model |
"" |
Engine id. Empty = first completion model from the API. |
copilotClient.prefixTokens |
1800 |
Approx. token budget for the prefix (text before cursor). |
copilotClient.suffixTokens |
500 |
Approx. token budget for the suffix (text after cursor). |
copilotClient.maxTokens |
2048 |
Maximum tokens the model may generate. |
vscode.authenticationGitHub session → exchange the OAuth token for the Copilot API token athttps://api.github.com/copilot_internal/v2/token(response also carriesendpoints.proxy, the FIM base URL).- Prompt = text before the cursor (truncated), suffix = text after the cursor.
POST {proxy}/v1/engines/{model}/completionswith SSE streaming (headers:Authorization,OpenAI-Intent: copilot-ghost,X-GitHub-Api-Version).- Post-process the stream, then return an
InlineCompletionItemwhose range covers the current line from its start to the cursor.
- 401 / 403 — token invalid or expired: run VSCodium Copilot Client: Refresh token. If the GitHub session lacks the required scopes, sign out of GitHub in VSCodium and sign back in.
- 402 — free monthly quota exhausted.
- 429 — rate limited; wait a few seconds.
- Basic errors, dialogs — run VSCodium Copilot Client: Check API status to verify auth, proxy, and model list; watch the notification for the actual error.
src/
extension.ts entry point + inline completion provider
token.ts Copilot token exchange & caching
models.ts completion model list from CAPI /models
completions.ts SSE streaming against /v1/engines/{model}/completions
truncate.ts prefix/suffix token-budget truncation
postprocess.ts minimal completion cleaning