Skip to content

About

LMM OAuth provider for VS Code Copilot Chat

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LMM for Copilot

LMM logo

The icon has an editable SVG source with the LMM ribbon and an editor-window mark; asset provenance is included in the package.

Preview: Requires a deployed LMM server with lmm-vscode OAuth registration. The extension checks server support before opening the browser; local tests do not establish production account or model access.

Use the models available to your LMM account in the native VS Code Chat model picker. Sign in with your browser; no API key is required.

Setup

  1. Install LMM for Copilot in desktop VS Code 1.104 or newer. Install or enable the VS Code Chat / GitHub Copilot Chat interface if it is not already available.
  2. Run LMM: Sign In from the Command Palette. Approve access and select model groups in the LMM browser consent screen.
  3. Open Chat, select LMM in the model picker (or Manage Models), and choose a group/model. Run LMM: Refresh Models after changing access.
  4. Run LMM: Sign Out to remove the local credential and revoke the server grant.

LMM account balance and current server pricing apply to every request. This extension does not provide free Copilot credits or an inline tab-completion provider. Chat UI availability and account requirements are controlled by your VS Code / Copilot installation.

The consent screen identifies VS Code, and editor credentials remain separate from Pi, Zed, and other LMM clients. An older server without editor registration produces a clear sign-in error rather than opening a misleading authorization page.

OAuth login uses a temporary listener bound only to 127.0.0.1, random state, S256 PKCE, and an issuer-bound callback. Credentials are stored through VS Code SecretStorage. Expiring tokens rotate automatically; a durable hashed journal prevents refresh-token replay across windows or after a crash. If a rotation is interrupted, sign in again. Credentials, authorization codes, prompts, and responses are never logged by this extension.

The extension runs on the desktop UI host, including Remote SSH workspaces. Browser-only vscode.dev is not supported. A browser must be able to reach the VS Code computer's loopback address. No issuer override or API-key fallback is supported.

Models and tools

The OAuth catalog determines available groups and models. Run LMM: Show Authorized Models to inspect every authorized route, including responses-only, Anthropic-only, embedding, image, video, speech and reranking entries. This searchable directory retains server labels, upstream IDs, group routes and multipliers, labels unknown metadata, and explains Chat limitations. It does not send a model request. The stable VS Code Chat API has no disabled-model state, so the native Chat picker only contains routes this provider can call: OpenAI chat completions with text output. Known non-chat/non-text entries remain excluded from Chat even when limits or tool settings are overridden. Images and non-text tool results are unsupported and produce a clear error. API compatibility is checked again before each generation.

Model names include group / server model label · group multiplier so identical models in different groups remain distinguishable. The authorized directory also shows the exact upstream ID. Multipliers come from the authenticated LMM catalog, never from the public model directory; unavailable multipliers are labeled unknown, not zero.

The OAuth catalog does not provide verified context limits or function-calling capability. Exact upstream IDs and provider-qualified IDs (for example, openai/gpt-5) are matched against a bundled models.dev reference snapshot (MIT; attribution in assets/models.dev-LICENSE.txt). No external metadata request occurs at runtime. These are upstream reference limits, not guarantees about an LMM gateway route. The snapshot retains nine reviewed direct-vendor sources and their exact IDs, types, modalities and independent input limits. Conflicting metadata for an unqualified ID remains unknown; group names never select a vendor. Input budgets use the smaller of the upstream input limit and the context window after reserving output. lmm.maxOutputTokens defaults to 4,096 and is capped by the model's output limit; an explicitly configured lmm.maxInputTokens caps input across all models. Unknown aliases retain the labeled 32,768 input / 4,096 output compatibility estimate; no fuzzy name matching is used. Tooltips identify the limit source. Token counting remains a conservative UTF-8 byte estimate, not the model's exact tokenizer.

For verified gateway limits, set lmm.modelLimits in VS Code settings. Keys are exact upstream IDs or canonical lmm:group_id:model_id wire IDs; a wire ID overrides the upstream ID for group-specific limits. Example:

"lmm.modelLimits": {
  "my-exact-model-id": { "contextWindow": 128000, "maxOutputTokens": 16000 }
}

The status bar displays wallet balance from /api/oauth2/balance, after sign-in, every five minutes, and after generation requests. Click it or run LMM: Refresh Balance to refresh. V2 balances show verified USD and platform credits; legacy V1 balances retain their legacy wallet-unit label, not an assumed dollar conversion. The wallet is not an OAuth spending allowance. Missing permission and failed refreshes display an unavailable state instead of an old balance. Sign-out invalidates pending UI updates.

Tools are disabled by default. After verifying that a model supports OpenAI function calling, add its canonical lmm:group_id:model_id wire ID to lmm.toolModels for one group route, or its exact upstream model ID to enable all groups for that ID. Tool permission and token budgets are checked again before each request, so removing permission or reducing a budget affects stale picker selections too. Refresh the picker; the model can then be selected for tool-based Chat/Agent workflows. The provider emits tool calls to VS Code; VS Code owns approvals and tool execution. No arbitrary model option can override the OAuth group, relay destination, or credentials. Billable requests are never retried automatically.

Build and test

npm ci --ignore-scripts
npm test
npm run package
# Optional real desktop extension-host smoke (installed VS Code and a display required):
npm run test:host

npm test compiles against the stable VS Code 1.104 API and runs OAuth rotation, cross-window replay, catalog authorization, callback security, SSE, model metadata, and wallet/status race tests. npm run package creates lmm-copilot-provider-0.1.3.vsix; the extension has no runtime npm dependencies.

Install the local package with code --install-extension ./lmm-copilot-provider-0.1.3.vsix. A real OAuth/model request requires the production server to register public native client lmm-vscode with loopback /oauth/lmm/callback, the required scopes, and the OAuth relay endpoints.

To update the offline reference, download and review https://models.dev/api.json, then run python3 -B scripts/update-model-metadata.py /path/to/api.json --retrieved ISO_UTC_TIMESTAMP --revision REVIEWED_MODELS_DEV_SHA. The snapshot records the raw response hash and reviewed upstream revision. Run the tests and package checks again; directory capability flags are reference information and do not enable gateway tools.

Marketplace publishing

The manifest publisher is LIghtJUNction. Publishing requires control of that exact Visual Studio Marketplace publisher and an Azure DevOps Personal Access Token authorized to manage extensions. Run npx vsce publish --packagePath ./lmm-copilot-provider-0.1.3.vsix from an authenticated publisher environment. Open VSX additionally requires an Open VSX account, a matching owned namespace, publisher agreement, and its own access token. Never put publishing tokens in repository files.

Packaging and automated tests do not establish a successful browser OAuth session, paid model request, or Marketplace listing. Those must be verified separately.

Development sources

The provider follows Microsoft's Language Model Chat Provider API, stable 1.104 API types, and official provider sample. OAuth relay contracts are implemented by the LMM server in this repository.

About

LMM OAuth provider for VS Code Copilot Chat

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages