emant's profile picture
emant

openai-compat-endpoint

Public

Forked from tupik/openai-compat-endpoint

Added a drop-down list of models. Models @openrouter.ai are used. baseUrl: "https://openrouter.ai/api/v1"

51 Downloads

1 star

README

OpenAI Compatible Endpoint for LM Studio

Use any OpenAI-compatible API in LM Studio via OpenRouter.ai.

Features

  • Model Dropdown - Select from cached free models (24+ available)
  • Auto Mode - Automatically uses the first available free model
  • Custom Model ID - Enter any model manually (e.g., openai/gpt-4o)
  • Request Tracking - Shows request count (25 free requests max)
  • Background Caching - Model list refreshes automatically every hour

Installation

npm install
npm run build
npm run dev

Or install locally without pushing to Hub:

lms dev --install -y

Configuration

Global Settings (apply to all chats)

  • API Key (optional for free models)

  • Base URL (default: https://openrouter.ai/api/v1)

    • Only change if using a different OpenAI-compatible API

Per-Chat Settings

  • Model - Dropdown to select a model

    • "— Auto —" uses the first available free model
    • Or pick a specific model from the list
  • Custom Model ID - Manual input

    • Enter any model ID (e.g., anthropic/claude-3.5-sonnet)
    • Overrides the dropdown selection
  • Only Free Models (default: on)

    • When off, shows all models (requires API key)

Usage

  • Open LM Studio and activate this plugin
  • On first run, the model cache is empty — the plugin will load models on first generation
  • Or manually refresh by restarting the plugin after initial use
  • Select a model or use Auto mode
  • Start chatting

Rate Limits

  • Free tier: ~25 requests per day (varies by model)
  • Free models: Look for the :free suffix (e.g., x-ai/grok-4.1-fast:free)
  • Some models may return 429 after a few requests

Available Free Models

The plugin caches free models on startup. Common ones include:

  • x-ai/grok-4.1-fast:free
  • stepfun/step-3.5-flash:free
  • arcee-ai/trinity-mini:free

Development Commands

npm run build    # Compile TypeScript
npm run dev     # Run in development mode
npm run push    # Push to LM Studio Hub

Files

  • src/ - TypeScript source
  • dist/ - Compiled JavaScript
  • models-cache.json - Cached model list (generated at runtime)