@belto_inc/slyos
v0.1.3
Published
Belto SlyOS SDK: local-first AI infrastructure for apps.
Readme
@belto_inc/slyos
Belto SlyOS SDK for local-first and hybrid AI infrastructure.
npm install @belto_inc/slyosimport { Belto } from "@belto_inc/slyos";
const belto = new Belto({
apiKey: process.env.BELTO_API_KEY!,
mode: "local-first"
});
await belto.initialize();
const response = await belto.chat({
messages: [{ role: "user", content: "Summarize this document" }],
rag: true
});
console.log(response.text);
console.log(response.route);By default the SDK runs in local-first mode and auto-detects real local runtimes:
- Node/Electron/dev machines:
AutoLocalRuntimeAdapteruses Ollama whenhttp://127.0.0.1:11434is available. - Browsers:
AutoLocalRuntimeAdapteruses WebLLM when WebGPU and@mlc-ai/web-llmare available. - Cloud fallback: SmartRoute uses the Belto API and Amazon Bedrock only when local is unavailable, blocked by policy, or the request is better suited to cloud.
For the simplest local test:
ollama serve
ollama pull llama3.2:3bThen run the SDK with mode: "local-first". SmartRoute will report a local route for simple prompts when the local model is available.
Edge RAG is also enabled by default:
await belto.addDocuments({
storageStrategy: "edge-first",
maxEdgeStorageBytes: 25 * 1024 * 1024,
cloudSpillover: true,
knowledgeBaseId: "kb_optional_for_cloud_spillover",
documents: [{ filename: "faq.txt", rawText: "Belto keeps this context on device first." }]
});Node/Electron stores edge chunks under ~/.belto-slyos/rag; browsers store them in IndexedDB.
