GENAI LoginGENAI Login is a desktop VS Code extension that connects OpenAI-compatible clients to the University of Macau's GENAI service through a local API bridge. Authentication uses the standard UMPASS sign-in and MFA flow. This is an independent community project, not an official University of Macau extension. Access requires an authorized university account and remains subject to the service's usage policies. User Guide | Pricing Reference | Changelog Features
Requirements
The extension runs in the local UI extension host, including when the workspace is connected through Remote-SSH. Its bridge listens on the client machine, not the remote host. InstallationGENAI Login is available on the official Visual Studio Marketplace.
Alternatively, install directly from the Marketplace using the command line:
Enable Auto Update in the extension's management menu to receive future versions directly in VS Code. Existing users should verify this option is enabled. Automatic updates follow VS Code's update settings. Version 0.0.16 is the final GitHub Release. Future extension versions will be distributed through the Marketplace. This repository remains the home for source code, changelogs, and issue tracking. Node.js and npm are not required to install or use the extension. Finish active requests before restarting extensions or reloading participating windows. Saved credentials, settings, and usage history are retained. Quick Start
Manual connection is optional. GENAI Login: Login and connect can prepare the session in advance. If no credentials have been saved, the first API request prompts for them in VS Code. Passwords remain in SecretStorage, not in client or MCP configuration. Client Connection
The bridge supports streaming chat responses. Image generation follows the platform's configured image engine (for example Qwen-Image); its response is converted to the OpenAI Images shape ( Image results are limited to six files and 20 MiB of decoded image bytes per request. Only platform file-content URLs and recognized PNG, JPEG, WebP or GIF bytes are accepted. Image requests are counted in the dashboard, but token usage is left unknown rather than estimated. GitHub CopilotRun GENAI Login: Manage Copilot models to add or remove models in the current VS Code Profile. Presets are defined in genai-models.json. Streaming reasoning uses a stable identifier for each continuous thinking phase. The bridge preserves upstream identifiers and carries them forward when later reasoning fragments omit them; phases without an upstream identifier receive a generated Copilot presets include chat models only. For drawing, select 添加绘画 MCP in the GENAI Login dashboard or run GENAI Login: Add Qwen Image 2.1 drawing MCP server. This enables the extension's native MCP provider in user settings without rewriting The embedded MCP server uses the current bridge port and calls Changes require confirmation and create a backup before saving. Unrelated providers and model settings are preserved; unsaved or concurrently modified configuration files must be resolved before proceeding. Background ConnectionAfter VS Code finishes starting, the extension opens a loopback listener without reading credentials, loading the authentication dependencies, starting Edge, or scheduling health checks. The first authorized request to Production builds keep the dashboard, Cookie session, network client and model configuration in separate on-demand bundles. Statistics and streaming modules stay unloaded during idle activation and brief status queries; full dashboard statistics or an API request loads them on demand. HTTP loads only when a listener or shared status request is needed. Shared status uses bounded native loopback HTTP, avoiding fetch initialization in observing windows. When browser authentication is necessary, a short-lived helper process owns Playwright and Edge; it exits after normal verification so those dependencies do not remain in the extension host. Credentials and Cookie updates travel through local IPC, not command-line arguments or temporary files. A diagnostic helper stays open only while its browser is retained. The drawing MCP bundle uses the official SDK's ESM distribution with a fixed tool schema and one shared, lazily compiled input validator. Image decoding and file saving proceed one image at a time rather than retaining every decoded image. The dashboard caches its static elements, skips unchanged DOM writes, reuses unchanged lists and runs its uptime timer only while connected and visible. Request updates reuse the loaded history base instead of repeatedly aggregating older records; streaming diagnostics avoid per-event temporary arrays where possible. Concurrent requests share one login. Cancelling a waiting client releases that request without cancelling the shared login or forwarding the cancelled request later. The first request can wait for MFA, so the client's own request timeout must allow enough time for verification. The extension must be enabled and a desktop VS Code window must remain open; an HTTP request cannot launch a closed VS Code application. Disconnect cancels the shared session, active requests and session checks for all participating windows, then returns to a lightweight standby listener. It does not log in again in the background. The next authorized chat or image request connects automatically, including after reloads or opening new windows. Failed MFA or rejected credentials still stop repeated verification attempts until an explicit reconnect or disconnect resets that state. Temporary connection failures leave the listener available for later requests. ConfigurationOpen VS Code Settings and search for GENAI Login.
Reload participating windows after changing admission limits. The owner window enforces one FIFO queue across chat, image and model requests; queued requests do not buffer their complete bodies, and cancellation removes them immediately. Internal status and MCP discovery remain outside generation admission; MCP image calls use the same image-request queue. Raising concurrency does not raise upstream account limits. Chat request metadata is parsed once without rewriting the forwarded body. Streaming usage and mixed-reasoning normalization share decoded events, preserving ordinary SSE bytes, tool calls and final usage. Response activity reads a lightweight timestamp; Cookie expiry still follows the original health-check schedule. Upstream Session HealthHealth checks adapt to request activity: normally after two idle minutes, with a five-minute maximum interval during healthy operation. Known token expiry advances the next check. Temporary outages and rate limits use backoff rather than triggering a new login. Health checks do not extend a fixed server-side token lifetime. Genuine expiry or revocation may require authentication and MFA again. See the User Guide for recovery steps. Multiple WindowsWindows using the same extension storage and bridge port share connection status and can connect, recover or disconnect from any window. Background synchronization continues while dashboards are hidden. One window holds the port at a time; if it closes, a remaining window that observed the active connection takes over and checks the saved session without starting another MFA flow. Allow a short handover interval for the two-second background check and session verification. A missing or invalid saved session requires an explicit connection attempt. After all windows close, reopening starts on standby: a stored Unchanged control records require only a file-metadata check; locked JSON reads happen after a change. Hidden windows request only connection status, without loading history or aggregating model usage. Opening the dashboard requests the full statistics again. An explicit disconnect applies to every participating window and is not treated as a window closing. A small atomic control record stores only the connection intent and a revision, never credentials or cookies. Reload every participating window after upgrading; older versions do not support shared control. Credential changes, clearing saved credentials and visible diagnostics still require a disconnected connection. Requests already running in a window that exits can be interrupted and are not replayed automatically. Closing every desktop window still stops the bridge. Usage StatisticsThe dashboard records request attempts and token usage reported by GENAI. Missing token usage is not estimated. History is local to the extension storage and survives disconnects and credential clearing; unfinished responses or pending writes may be lost if VS Code exits unexpectedly. The dashboard opens without waiting for history IO. A single Cost estimates use reference model rates and documented assumptions. They are not GENAI billing records. See PRICING.md for rates and estimation details. Security and Limitations
DevelopmentUse Node.js 24 and npm. Microsoft Edge is required for browser regression tests.
Browser authentication tests use intercepted responses and cover both in-process form logic and the isolated browser helper. Successful university login must be verified separately with an authorized account. Development benchmarks must distinguish JS heap, process RSS, dependency loading and overall VS Code startup; lower extension loading time is not a guarantee for total window startup time. ContributingBug reports and focused pull requests are welcome. Use GitHub Issues to describe the expected behavior, reproduction steps, extension version, and VS Code version. Include only sanitized diagnostics; never attach passwords, cookies, tokens, or authentication callback URLs. LicenseLicensed under the MIT License. |