文档
列出本地模型
您可以使用 listLocalModels
方法迭代本地可用的模型。
listLocalModels
位于 LMStudioClient
对象的 system
命名空间下。
import { LMStudioClient } from "@lmstudio/sdk";
const client = new LMStudioClient();
console.info(await client.system.listDownloadedModels());
这将为您提供与在 CLI 中使用 lms ls
相同的结果。
[ { "type": "llm", "modelKey": "qwen2.5-7b-instruct", "format": "gguf", "displayName": "Qwen2.5 7B Instruct", "path": "lmstudio-community/Qwen2.5-7B-Instruct-GGUF/Qwen2.5-7B-Instruct-Q4_K_M.gguf", "sizeBytes": 4683073952, "paramsString": "7B", "architecture": "qwen2", "vision": false, "trainedForToolUse": true, "maxContextLength": 32768 }, { "type": "embedding", "modelKey": "text-embedding-nomic-embed-text-v1.5@q4_k_m", "format": "gguf", "displayName": "Nomic Embed Text v1.5", "path": "nomic-ai/nomic-embed-text-v1.5-GGUF/nomic-embed-text-v1.5.Q4_K_M.gguf", "sizeBytes": 84106624, "architecture": "nomic-bert", "maxContextLength": 2048 } ]