noosphere 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +216 -0
- package/dist/index.cjs +1039 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +148 -2
- package/dist/index.d.ts +148 -2
- package/dist/index.js +1033 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -324,6 +324,222 @@ const imageModels = await ai.getModels('image');
|
|
|
324
324
|
|
|
325
325
|
---
|
|
326
326
|
|
|
327
|
+
## Local Models — Run Everything on Your Machine
|
|
328
|
+
|
|
329
|
+
Noosphere has **comprehensive local model support** across all modalities — LLM, image, video, TTS, STT, and music. Auto-discovers what's installed, catalogs what's available to download, and provides a unified API for everything.
|
|
330
|
+
|
|
331
|
+
### Quick Start
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
const ai = new Noosphere();
|
|
335
|
+
await ai.syncModels();
|
|
336
|
+
|
|
337
|
+
// 774 models discovered — cloud + local, all modalities
|
|
338
|
+
const all = await ai.getModels();
|
|
339
|
+
|
|
340
|
+
// Filter by what you can run locally
|
|
341
|
+
const localModels = all.filter(m => m.local || m.status === 'installed');
|
|
342
|
+
|
|
343
|
+
// What's installed vs what's available to download
|
|
344
|
+
const installed = all.filter(m => m.status === 'installed'); // 39 models ready to use
|
|
345
|
+
const available = all.filter(m => m.status === 'available'); // 251 models you can download
|
|
346
|
+
|
|
347
|
+
// Chat with a local Ollama model — same API as cloud
|
|
348
|
+
const result = await ai.chat({
|
|
349
|
+
model: 'qwen3:8b',
|
|
350
|
+
provider: 'ollama',
|
|
351
|
+
messages: [{ role: 'user', content: 'Hello!' }],
|
|
352
|
+
});
|
|
353
|
+
console.log(result.content); // "Hello! How can I help?"
|
|
354
|
+
console.log(result.usage); // { cost: 0, input: 24, output: 198, unit: 'tokens' }
|
|
355
|
+
|
|
356
|
+
// Install a new model from Ollama library
|
|
357
|
+
await ai.installModel('deepseek-r1:14b');
|
|
358
|
+
|
|
359
|
+
// Uninstall
|
|
360
|
+
await ai.uninstallModel('deepseek-r1:14b');
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### 8 Providers, 5 Modalities, 774+ Models
|
|
364
|
+
|
|
365
|
+
| Provider | Modality | Models | Source | Auto-Detect |
|
|
366
|
+
|---|---|---|---|---|
|
|
367
|
+
| **pi-ai** | LLM | 482 | OpenAI, Anthropic, Google, Groq, Mistral, xAI, OpenRouter, Cerebras | API keys |
|
|
368
|
+
| **ollama** | LLM, embedding | 70 | 38 installed + 32 from Ollama web catalog | `localhost:11434` |
|
|
369
|
+
| **hf-local** | image, video, tts, stt | 220 | HuggingFace catalog (FLUX, SDXL, Wan2.2, Whisper, MusicGen) | Always |
|
|
370
|
+
| **comfyui** | image, video | dynamic | Installed checkpoints + CivitAI catalog | `localhost:8188` |
|
|
371
|
+
| **openai-compat** | LLM | dynamic | llama.cpp, LM Studio, vLLM, LocalAI, KoboldCpp, Jan, TabbyAPI | Scans ports |
|
|
372
|
+
| **piper** | TTS | 2+ | Piper voices installed locally | Binary detection |
|
|
373
|
+
| **whisper-local** | STT | 8 | Whisper/Faster-Whisper (tiny → large-v3) | Python detection |
|
|
374
|
+
| **audiocraft** | music | 5 | MusicGen (small/medium/large/melody) + AudioGen | Python detection |
|
|
375
|
+
|
|
376
|
+
### Models by Modality
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
const models = await ai.getModels();
|
|
380
|
+
|
|
381
|
+
// Filter by modality
|
|
382
|
+
const llm = models.filter(m => m.modality === 'llm'); // 552 (cloud + Ollama local)
|
|
383
|
+
const image = models.filter(m => m.modality === 'image'); // 101 (FLUX, SDXL, SD3, PixArt...)
|
|
384
|
+
const tts = models.filter(m => m.modality === 'tts'); // 61 (MusicGen, Bark, Piper, Kokoro...)
|
|
385
|
+
const video = models.filter(m => m.modality === 'video'); // 30 (Wan2.2, CogVideoX, AnimateDiff...)
|
|
386
|
+
const stt = models.filter(m => m.modality === 'stt'); // 30 (Whisper, wav2vec2...)
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Ollama Provider — Local LLM
|
|
390
|
+
|
|
391
|
+
Full integration with Ollama's API:
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
// Auto-detected on startup — no config needed
|
|
395
|
+
// Models include full metadata from Ollama
|
|
396
|
+
|
|
397
|
+
const ollamaModels = models.filter(m => m.provider === 'ollama');
|
|
398
|
+
for (const m of ollamaModels) {
|
|
399
|
+
console.log(m.id); // "llama3.3:70b"
|
|
400
|
+
console.log(m.status); // "installed" | "available" | "running"
|
|
401
|
+
console.log(m.localInfo.parameterSize); // "70.6B"
|
|
402
|
+
console.log(m.localInfo.quantization); // "Q4_K_M"
|
|
403
|
+
console.log(m.localInfo.sizeBytes); // 42520413916
|
|
404
|
+
console.log(m.localInfo.family); // "llama"
|
|
405
|
+
console.log(m.logo); // { svg: "...meta.svg", png: "...meta.png" }
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// Chat with streaming
|
|
409
|
+
const stream = ai.stream({
|
|
410
|
+
model: 'qwen3:8b',
|
|
411
|
+
provider: 'ollama',
|
|
412
|
+
messages: [{ role: 'user', content: 'Explain quantum computing' }],
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
for await (const event of stream) {
|
|
416
|
+
if (event.type === 'text_delta') process.stdout.write(event.delta);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const finalResult = await stream.result();
|
|
420
|
+
|
|
421
|
+
// Model management
|
|
422
|
+
await ai.installModel('deepseek-r1:14b'); // Downloads from Ollama library
|
|
423
|
+
await ai.uninstallModel('old-model:7b'); // Removes from disk
|
|
424
|
+
|
|
425
|
+
// Hardware info
|
|
426
|
+
const hw = await ai.getHardware();
|
|
427
|
+
// { ollama: true, runningModels: [{ name: 'qwen3:8b', size: 5200000000, ... }] }
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
### OpenAI-Compatible Provider — Any Local Server
|
|
431
|
+
|
|
432
|
+
Connects to ANY server that implements the OpenAI API:
|
|
433
|
+
|
|
434
|
+
```typescript
|
|
435
|
+
// Auto-detects servers on common ports:
|
|
436
|
+
// llama.cpp (:8080), LM Studio (:1234), vLLM (:8000)
|
|
437
|
+
// LocalAI (:8080), TabbyAPI (:5000), KoboldCpp (:5001), Jan (:1337)
|
|
438
|
+
|
|
439
|
+
// Or configure manually:
|
|
440
|
+
const ai = new Noosphere({
|
|
441
|
+
openaiCompat: [
|
|
442
|
+
{ baseUrl: 'http://localhost:1234/v1', name: 'LM Studio' },
|
|
443
|
+
{ baseUrl: 'http://192.168.1.100:8080/v1', name: 'Remote llama.cpp' },
|
|
444
|
+
],
|
|
445
|
+
});
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### HuggingFace Local Catalog
|
|
449
|
+
|
|
450
|
+
Auto-fetches the top models by downloads for each modality:
|
|
451
|
+
|
|
452
|
+
```typescript
|
|
453
|
+
const imageModels = models.filter(m => m.provider === 'hf-local' && m.modality === 'image');
|
|
454
|
+
// → FLUX.1-dev, FLUX.1-schnell, SDXL, SD 3.5, PixArt-Σ, Playground v2.5, Kolors...
|
|
455
|
+
|
|
456
|
+
const videoModels = models.filter(m => m.provider === 'hf-local' && m.modality === 'video');
|
|
457
|
+
// → Wan2.2-T2V, CogVideoX-5b, AnimateDiff, Stable Video Diffusion...
|
|
458
|
+
|
|
459
|
+
const ttsModels = models.filter(m => m.provider === 'hf-local' && m.modality === 'tts');
|
|
460
|
+
// → MusicGen, Stable Audio Open, Bark, ACE-Step...
|
|
461
|
+
|
|
462
|
+
const sttModels = models.filter(m => m.provider === 'hf-local' && m.modality === 'stt');
|
|
463
|
+
// → Whisper large-v3, Whisper large-v3-turbo, wav2vec2...
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
Models already downloaded to `~/.cache/huggingface/hub/` are automatically detected as `status: 'installed'`.
|
|
467
|
+
|
|
468
|
+
### ComfyUI — Dynamic Workflow Engine
|
|
469
|
+
|
|
470
|
+
When ComfyUI is running, noosphere discovers all installed checkpoints, LoRAs, and models:
|
|
471
|
+
|
|
472
|
+
```typescript
|
|
473
|
+
// Auto-detected on localhost:8188
|
|
474
|
+
const comfyModels = models.filter(m => m.provider === 'comfyui');
|
|
475
|
+
// → All checkpoints (SD 1.5, SDXL, FLUX, Pony, etc.)
|
|
476
|
+
|
|
477
|
+
// Also fetches top models from CivitAI as "available"
|
|
478
|
+
const civitai = comfyModels.filter(m => m.status === 'available');
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### Model Status & Local Info
|
|
482
|
+
|
|
483
|
+
Every local model includes rich metadata:
|
|
484
|
+
|
|
485
|
+
```typescript
|
|
486
|
+
interface ModelInfo {
|
|
487
|
+
id: string;
|
|
488
|
+
provider: string;
|
|
489
|
+
modality: 'llm' | 'image' | 'video' | 'tts' | 'stt' | 'music' | 'embedding';
|
|
490
|
+
status?: 'installed' | 'available' | 'downloading' | 'running' | 'error';
|
|
491
|
+
local: boolean;
|
|
492
|
+
logo?: { svg?: string; png?: string };
|
|
493
|
+
localInfo?: {
|
|
494
|
+
sizeBytes: number;
|
|
495
|
+
family?: string; // "llama", "gemma3", "qwen2"
|
|
496
|
+
parameterSize?: string; // "70.6B", "7B", "3.2B"
|
|
497
|
+
quantization?: string; // "Q4_K_M", "Q8_0", "F16"
|
|
498
|
+
format?: string; // "gguf", "safetensors", "onnx"
|
|
499
|
+
digest?: string;
|
|
500
|
+
modifiedAt?: string;
|
|
501
|
+
running?: boolean;
|
|
502
|
+
runtime: string; // "ollama", "diffusers", "comfyui", "piper", "whisper"
|
|
503
|
+
};
|
|
504
|
+
capabilities: {
|
|
505
|
+
contextWindow?: number;
|
|
506
|
+
maxTokens?: number;
|
|
507
|
+
supportsVision?: boolean;
|
|
508
|
+
supportsStreaming?: boolean;
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
### Web Catalogs (Auto-Fetched)
|
|
514
|
+
|
|
515
|
+
| Source | API | What it provides |
|
|
516
|
+
|---|---|---|
|
|
517
|
+
| **Ollama Library** | `ollama.com/api/tags` | 215+ LLM families with sizes and quantizations |
|
|
518
|
+
| **HuggingFace** | `huggingface.co/api/models?pipeline_tag=...` | Top models per modality (image, video, TTS, STT) |
|
|
519
|
+
| **CivitAI** | `civitai.com/api/v1/models` | SD/SDXL/FLUX checkpoints with previews |
|
|
520
|
+
|
|
521
|
+
### Auto-Detection — Zero Config
|
|
522
|
+
|
|
523
|
+
Noosphere auto-detects all local runtimes on startup:
|
|
524
|
+
|
|
525
|
+
| Runtime | Detection Method | Default Port |
|
|
526
|
+
|---|---|---|
|
|
527
|
+
| Ollama | `GET localhost:11434/api/version` | 11434 |
|
|
528
|
+
| ComfyUI | `GET localhost:8188/system_stats` | 8188 |
|
|
529
|
+
| llama.cpp | `GET localhost:8080/health` | 8080 |
|
|
530
|
+
| LM Studio | `GET localhost:1234/v1/models` | 1234 |
|
|
531
|
+
| vLLM | `GET localhost:8000/v1/models` | 8000 |
|
|
532
|
+
| KoboldCpp | `GET localhost:5001/v1/models` | 5001 |
|
|
533
|
+
| TabbyAPI | `GET localhost:5000/v1/models` | 5000 |
|
|
534
|
+
| Jan | `GET localhost:1337/v1/models` | 1337 |
|
|
535
|
+
| Piper | Binary in PATH | — |
|
|
536
|
+
| Whisper | Python package detection | — |
|
|
537
|
+
| AudioCraft | Python package detection | — |
|
|
538
|
+
|
|
539
|
+
> 📄 **Full research:** [`docs/LOCAL_AI_RESEARCH.md`](./docs/LOCAL_AI_RESEARCH.md) — 44KB covering 12+ runtimes across all modalities
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
327
543
|
## Configuration
|
|
328
544
|
|
|
329
545
|
API keys are resolved from the constructor config or environment variables (config takes priority):
|