文档

LM Studio REST API

列出您的模型

获取系统上可用模型的列表,包括 LLM(大语言模型)和嵌入模型。

GET /api/v1/models

此接口没有请求参数。

curl https://:1234/api/v1/models \
  -H "Authorization: Bearer $LM_API_TOKEN"

响应字段

models : array (数组)

可用模型列表(包含 LLM 和嵌入模型)。

type : "llm" | "embedding"

模型类型。

publisher : string (字符串)

模型发布者名称。

key : string (字符串)

模型的唯一标识符。

display_name : string (字符串)

易读的模型名称。

architecture (可选) : string | null (字符串或空值)

模型架构(例如 "llama", "mistral")。嵌入模型不包含此项。

quantization : object | null (对象或空值)

模型的量化信息。

name : string | null (字符串或空值)

量化方法名称。

bits_per_weight : number | null (数字或空值)

量化的每权重位数。

size_bytes : number (数字)

模型大小(以字节为单位)。

params_string : string | null (字符串或空值)

易读的参数数量(例如 "7B", "13B")。

loaded_instances : array (数组)

当前已加载的该模型实例列表。

id : string (字符串)

已加载模型实例的唯一标识符。

config : object (对象)

已加载实例的配置。

context_length : number (数字)

模型的最大上下文长度(以 token 数量计)。

eval_batch_size (可选) : number (数字)

评估期间在单个批次中一起处理的输入 token 数量。嵌入模型不包含此项。

flash_attention (可选) : boolean (布尔值)

是否启用 Flash Attention 以优化注意力计算。嵌入模型不包含此项。

num_experts (可选) : number (数字)

MoE (混合专家模型) 的专家数量。嵌入模型不包含此项。

offload_kv_cache_to_gpu (可选) : boolean (布尔值)

是否将 KV 缓存卸载到 GPU 显存。嵌入模型不包含此项。

max_context_length : number (数字)

模型支持的最大上下文长度(以 token 数量计)。

format : "gguf" | "mlx" | null

模型文件格式。

capabilities (可选) : object (对象)

模型能力。嵌入模型不包含此项。

vision : boolean (布尔值)

模型是否支持视觉/图像输入。

trained_for_tool_use : boolean (布尔值)

模型是否经过工具/函数调用训练。

description (可选) : string | null (字符串或空值)

模型描述。嵌入模型不包含此项。

{
  "models": [
    {
      "type": "llm",
      "publisher": "lmstudio-community",
      "key": "gemma-3-270m-it-qat",
      "display_name": "Gemma 3 270m Instruct Qat",
      "architecture": "gemma3",
      "quantization": {
        "name": "Q4_0",
        "bits_per_weight": 4
      },
      "size_bytes": 241410208,
      "params_string": "270M",
      "loaded_instances": [
        {
          "id": "gemma-3-270m-it-qat",
          "config": {
            "context_length": 4096,
            "eval_batch_size": 512,
            "flash_attention": false,
            "num_experts": 0,
            "offload_kv_cache_to_gpu": true
          }
        }
      ],
      "max_context_length": 32768,
      "format": "gguf",
      "capabilities": {
        "vision": false,
        "trained_for_tool_use": false
      },
      "description": null
    },
    {
      "type": "embedding",
      "publisher": "gaianet",
      "key": "text-embedding-nomic-embed-text-v1.5-embedding",
      "display_name": "Nomic Embed Text v1.5",
      "quantization": {
        "name": "F16",
        "bits_per_weight": 16
      },
      "size_bytes": 274290560,
      "params_string": null,
      "loaded_instances": [],
      "max_context_length": 2048,
      "format": "gguf"
    }
  ]
}

此页面的源代码可在 GitHub 上找到