Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>GENAI LoginNew to Visual Studio Code? Get it now.
GENAI Login

GENAI Login

Petalzu

|
9 installs
| (0) | Free
UMPASS authentication and a local OpenAI-compatible bridge for University of Macau GENAI, with Copilot model configuration.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

GENAI Login

GENAI 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

  • Local API bridge with model listing, chat completions, streaming responses, and request cancellation.
  • On-demand connection for Copilot chat models and MCP image tools, with saved-session reuse, activity-aware health checks, and automatic authentication recovery.
  • Copilot model configuration with reviewed presets, explicit confirmation, and configuration backups.
  • One-click drawing MCP for Qwen Image 2.1, with an embedded server, image previews and local file saving. No separate Node.js, npm or ImageForge installation is required.
  • Connection dashboard with login progress, session health, model usage, and persistent token statistics.
  • Credential storage through VS Code SecretStorage rather than plain-text settings.

Requirements

  • Desktop VS Code 1.110 or later.
  • Microsoft Edge installed on the VS Code client machine.
  • A UMPASS account authorized to access GENAI.

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.

Installation

GENAI Login is available on the official Visual Studio Marketplace.

  1. Open Extensions in VS Code.
  2. Search for @id:Petalzu.genai-login and select GENAI Login by Petalzu.
  3. Select Install.

Alternatively, install directly from the Marketplace using the command line:

code --install-extension Petalzu.genai-login

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

  1. Open GENAI Login in the activity bar.
  2. Run GENAI Login: Save account and password to store your UMPASS credentials.
  3. Configure your client using the connection details below and send a request. The bridge connects in the background; complete any required MFA. A valid saved session skips browser login.

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

  • Base URL: http://127.0.0.1:58379/v1
  • API key: local-browser-session
  • Supported endpoints: GET /v1/models, POST /v1/chat/completions, and POST /v1/images/generations

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 (data[].b64_json) so OpenAI-compatible image clients can consume it. It is not a complete implementation of the OpenAI API, and browser-origin requests are rejected.

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 Copilot

Run 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 cot_id, isolated by request and choice. This prevents Copilot's renderer-generated fallback IDs from splitting later fragments into new blocks. Empty control choices do not end a phase, while answer text, tool calls, finish events and retained non-thinking control events do. Genuine phases are not merged, and reasoning text, answer order, tool payloads and usage are preserved. The bridge does not control Copilot's thinking titles or displayed durations.

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 mcp.json or changing other MCP servers. In Copilot Agent, select a tool-capable chat model and enable the GENAI / Qwen Image 2.1 server's generate_image tool. VS Code may require server trust and tool-call approval; those checks are not bypassed.

The embedded MCP server uses the current bridge port and calls /v1/images/generations with model: qwen-image-2.1. It returns image previews and saves original files under generated-images in the extension's local data directory; the result includes the file paths. No image chat-model registration or separate MCP process is needed. The platform's configured image engine determines the actual model used. See the User Guide for connection requirements.

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 Connection

After 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 /v1/chat/completions or /v1/images/generations initializes the session. While on standby, /v1/models returns the bundled model presets without logging in; connected model queries still use the upstream service. Internal status queries and rejected requests do not initiate login.

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.

Configuration

Open VS Code Settings and search for GENAI Login.

  • genai-login.port: local bridge port. Default: 58379; range: 1024-65535. Changing it requires reloading participating windows and updating client URLs.
  • genai-login.idleTimeoutSeconds: maximum time without upstream response data. Default: 0 (disabled); range: 0-86400. Applies to new requests and pauses during authentication. This is not a total generation deadline.
  • genai-login.maxConcurrentRequests: maximum active bridge requests, including authentication wait and response streaming. Default: 32; range: 1-256.
  • genai-login.maxQueuedRequests: maximum requests waiting for admission. Default: 64; range: 0-1024. A full queue returns HTTP 503 with Retry-After instead of starting another upstream request.
  • genai-login.maxBufferedRequestMiB: reserved request-body budget, including the temporary concatenation copy. Default: 128 MiB; range: 40-2048. Unknown-length uploads initially reserve twice the 20 MiB request limit; reservations shrink to the retained body size after upload. This is not a total process memory limit.
  • genai-login.queueTimeoutSeconds: maximum admission queue wait. Default: 60; range: 1-600. This deadline is separate from authentication and upstream idle timeouts.
  • genai-login.imageMcp.enabled: enable the built-in Qwen Image 2.1 MCP provider. Default: false; the one-click command sets it to true. Disable it in user settings to remove the provider's server from discovery. Generated files are retained until you delete them.

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 Retry-After, retry-after-ms and request identifiers are forwarded through an explicit header allowlist, without cookies or hop-by-hop headers.

Session Health

Health 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 Windows

Windows 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 connected intent alone never resumes authentication.

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 Statistics

The 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 usageHistory.total.v1.json cache supplies the last saved total while independent window records are checked in the background; only changed records are reread. Updates are coalesced in the background. Per-window records remain authoritative, so concurrent or stale cache writes cannot erase another window's usage. A missing or damaged cache is rebuilt without changing historical model assignments or prices.

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

  • Credentials and cookies are managed through VS Code SecretStorage, not plain-text configuration. Clearing them does not revoke the server-side session.
  • The bridge listens only on 127.0.0.1. Its compatibility API key is not a security boundary against other local programs; do not expose or forward the port to untrusted networks.
  • Authentication follows the university's sign-in process and does not bypass MFA. Temporary browser sessions do not guarantee remembered-device behavior across reconnects.
  • Failed or partially delivered generations are not automatically replayed. Review any partial output before retrying a request.
  • Requests remain subject to upstream availability, client timeouts, and account permissions.

Development

Use Node.js 24 and npm. Microsoft Edge is required for browser regression tests.

git clone https://github.com/Petalzu/GenaiLogin.git
cd GenaiLogin
npm ci
npm test

npm test runs lint checks, builds the production modules in dist, and runs Node.js regression tests and VS Code extension-host tests. npm run build rebuilds the modules; packaging runs the same build automatically. Keep the Playwright runtime assets external rather than bundling or pruning its internal files.

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.

Contributing

Bug 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.

License

Licensed under the MIT License.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft