openai-compat-endpoint

Public

src / config.ts

import { createConfigSchematics } from "@lmstudio/sdk";

// This file contains the definition of configuration schematics for your plugin.

export const configSchematics = createConfigSchematics()
    .field(
        "systemPrompt",
        "string",
        {
            displayName: "System Prompt",
            subtitle: "Customize the system prompt for the model. Supports dynamic variables like {date}, {time}, {model}.",
            placeholder: "You are a helpful assistant. Current date: {date}",
        },
        "",
    )
    .field(
        "model",
        "string",
        {
            displayName: "Model",
            subtitle: "Paste the canonical model name used for generation.",
            placeholder: "e.g., gpt-4.1 or claude-3.5-sonnet",
        },
        "claude-sonnet-4-20250514",
    )
    .field(
        "temperature",
        "numeric",
        {
            displayName: "Temperature",
            subtitle: "Controls randomness (0.0-2.0). Higher values make output more random.",
        },
        1.0,
    )
    .field(
        "top_p",
        "numeric",
        {
            displayName: "Top P",
            subtitle: "Nucleus sampling threshold (0.0-1.0). Lower values make output more focused.",
        },
        1.0,
    )
    .field(
        "frequency_penalty",
        "numeric",
        {
            displayName: "Frequency Penalty",
            subtitle: "Penalizes repeated tokens (-2.0 to 2.0). Higher values reduce repetition.",
        },
        0.0,
    )
    .field(
        "presence_penalty",
        "numeric",
        {
            displayName: "Presence Penalty",
            subtitle: "Penalizes tokens based on presence (-2.0 to 2.0). Encourages topic diversity.",
        },
        0.0,
    )
    .field(
        "max_tokens",
        "numeric",
        {
            displayName: "Max Tokens",
            subtitle: "Maximum number of tokens to generate. 0 means no limit.",
        },
        0,
    )
    .build();

export const globalConfigSchematics = createConfigSchematics()
    .field(
        "openaiApiKey",
        "string",
        {
            displayName: "OpenAI API Key",
            isProtected: true,
            placeholder: "sk-...",
        },
        "",
    )
    .field(
        "anthropicApiKey",
        "string",
        {
            displayName: "Anthropic API Key",
            isProtected: true,
            placeholder: "ant-...",
        },
        "",
    )
    .field(
        "thirdPartyApiKey",
        "string",
        {
            displayName: "Third-Party API Key",
            subtitle: "For Mistral, Groq, and other third-party APIs. Used with Override Base URL or auto-detected for Mistral models.",
            isProtected: true,
            placeholder: "Enter your API key",
        },
        "",
    )
    .field(
        "overrideBaseUrl",
        "string",
        {
            displayName: "(Optional) Override Base URL",
            subtitle: "Override the base URL for API calls. Leave empty to auto-detect based on model name.",
            placeholder: "https://api.example.com/v1",
        },
        "",
    )
    .build();