noosphere 0.4.1 → 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.
Files changed (71) hide show
  1. package/README.md +227 -19
  2. package/dist/index.cjs +1083 -33
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +149 -4
  5. package/dist/index.d.ts +149 -4
  6. package/dist/index.js +1077 -32
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -2
  9. package/assets/logos/png/ai21.png +0 -0
  10. package/assets/logos/png/amazon.png +0 -0
  11. package/assets/logos/png/anthropic.png +0 -0
  12. package/assets/logos/png/baidu.png +0 -0
  13. package/assets/logos/png/bytedance.png +0 -0
  14. package/assets/logos/png/cerebras.png +0 -0
  15. package/assets/logos/png/cohere.png +0 -0
  16. package/assets/logos/png/comfyui.png +0 -0
  17. package/assets/logos/png/deepseek.png +0 -0
  18. package/assets/logos/png/fal.png +0 -0
  19. package/assets/logos/png/fireworks-ai.png +0 -0
  20. package/assets/logos/png/google.png +0 -0
  21. package/assets/logos/png/groq.png +0 -0
  22. package/assets/logos/png/huggingface.png +0 -0
  23. package/assets/logos/png/ibm.png +0 -0
  24. package/assets/logos/png/inflection.png +0 -0
  25. package/assets/logos/png/kokoro.png +0 -0
  26. package/assets/logos/png/meta.png +0 -0
  27. package/assets/logos/png/microsoft.png +0 -0
  28. package/assets/logos/png/minimax.png +0 -0
  29. package/assets/logos/png/mistral.png +0 -0
  30. package/assets/logos/png/nebius.png +0 -0
  31. package/assets/logos/png/novita.png +0 -0
  32. package/assets/logos/png/nvidia.png +0 -0
  33. package/assets/logos/png/ollama.png +0 -0
  34. package/assets/logos/png/openai.png +0 -0
  35. package/assets/logos/png/openrouter.png +0 -0
  36. package/assets/logos/png/perplexity.png +0 -0
  37. package/assets/logos/png/pi-ai.png +0 -0
  38. package/assets/logos/png/piper.png +0 -0
  39. package/assets/logos/png/qwen.png +0 -0
  40. package/assets/logos/png/replicate.png +0 -0
  41. package/assets/logos/png/sambanova.png +0 -0
  42. package/assets/logos/png/tencent.png +0 -0
  43. package/assets/logos/png/together.png +0 -0
  44. package/assets/logos/png/upstage.png +0 -0
  45. package/assets/logos/png/xai.png +0 -0
  46. package/assets/logos/png/xiaomi.png +0 -0
  47. package/assets/logos/png/zai.png +0 -0
  48. package/assets/logos/svg/amazon.svg +0 -1
  49. package/assets/logos/svg/anthropic.svg +0 -1
  50. package/assets/logos/svg/baidu.svg +0 -1
  51. package/assets/logos/svg/cerebras.svg +0 -1
  52. package/assets/logos/svg/cohere.svg +0 -1
  53. package/assets/logos/svg/deepseek.svg +0 -1
  54. package/assets/logos/svg/fireworks-ai.svg +0 -9
  55. package/assets/logos/svg/google.svg +0 -1
  56. package/assets/logos/svg/groq.svg +0 -1
  57. package/assets/logos/svg/huggingface.svg +0 -67
  58. package/assets/logos/svg/meta.svg +0 -1
  59. package/assets/logos/svg/microsoft.svg +0 -1
  60. package/assets/logos/svg/mistral.svg +0 -1
  61. package/assets/logos/svg/nebius.svg +0 -4
  62. package/assets/logos/svg/novita.svg +0 -11
  63. package/assets/logos/svg/nvidia.svg +0 -1
  64. package/assets/logos/svg/ollama.svg +0 -7
  65. package/assets/logos/svg/openai.svg +0 -1
  66. package/assets/logos/svg/openrouter.svg +0 -21
  67. package/assets/logos/svg/perplexity.svg +0 -24
  68. package/assets/logos/svg/qwen.svg +0 -1
  69. package/assets/logos/svg/replicate.svg +0 -12
  70. package/assets/logos/svg/together.svg +0 -1
  71. package/assets/logos/svg/xai.svg +0 -1
package/README.md CHANGED
@@ -65,29 +65,21 @@ Noosphere **automatically discovers the latest models from EVERY provider's API
65
65
 
66
66
  ### Provider Logos — SVG & PNG for Every Model
67
67
 
68
- Every model returned by the auto-fetch includes a `logo` field with **absolute file paths** to the provider's official logo bundled in the package — SVG (vector) and PNG (512×512). No CDN dependencies, no external requests. For aggregator providers (OpenRouter, HuggingFace), logos are resolved to the **real upstream provider** — so an `x-ai/grok-4` model gets the xAI logo, not OpenRouter's.
68
+ Every model returned by the auto-fetch includes a `logo` field with **CDN URLs** to the provider's official logo — SVG (vector) and PNG (512×512), hosted on DigitalOcean Spaces. For aggregator providers (OpenRouter, HuggingFace), logos are resolved to the **real upstream provider** — so an `x-ai/grok-4` model gets the xAI logo, not OpenRouter's.
69
69
 
70
70
  ```typescript
71
- import { readFileSync } from 'fs';
72
-
73
71
  const models = await ai.getModels('llm');
74
72
 
75
73
  for (const model of models) {
76
74
  console.log(model.id, model.logo);
77
- // "gpt-5" { svg: "/path/to/node_modules/noosphere/assets/logos/svg/openai.svg",
78
- // png: "/path/to/node_modules/noosphere/assets/logos/png/openai.png" }
79
- // "claude-opus-4-6" { svg: "/.../anthropic.svg", png: "/.../anthropic.png" }
80
- // "gemini-2.5-pro" { svg: "/.../google.svg", png: "/.../google.png" }
81
-
82
- // Read the file directly:
83
- const svgContent = readFileSync(model.logo.svg, 'utf-8');
84
- const pngBuffer = readFileSync(model.logo.png);
85
-
86
- // Serve in Express:
87
- // app.get('/logo/:provider.svg', (req, res) => res.sendFile(model.logo.svg));
75
+ // "gpt-5" { svg: "https://...cdn.../openai.svg", png: "https://...cdn.../openai.png" }
76
+ // "claude-opus-4-6" { svg: "https://...cdn.../anthropic.svg", png: "https://...cdn.../anthropic.png" }
77
+ // "gemini-2.5-pro" { svg: "https://...cdn.../google.svg", png: "https://...cdn.../google.png" }
78
+ }
88
79
 
89
- // Use in React (copy to public/):
90
- // <img src={`/logos/${model.provider}.svg`} alt={model.provider} />
80
+ // Use directly in your UI:
81
+ // <img src={model.logo.svg} alt={model.provider} />
82
+ // <img src={model.logo.png} width={48} height={48} />;
91
83
  }
92
84
 
93
85
  // Providers also have logos:
@@ -112,7 +104,7 @@ You can also import the logo registry directly:
112
104
  import { getProviderLogo, PROVIDER_LOGOS, getAllProviderLogos } from 'noosphere';
113
105
 
114
106
  const logo = getProviderLogo('anthropic');
115
- // { svg: "/abs/path/to/anthropic.svg", png: "/abs/path/to/anthropic.png" }
107
+ // { svg: "https://...cdn.../anthropic.svg", png: "https://...cdn.../anthropic.png" }
116
108
 
117
109
  // Get all logos as a map:
118
110
  const allLogos = getAllProviderLogos();
@@ -128,8 +120,8 @@ const qwen = hfModels.find(m => m.id === 'Qwen/Qwen2.5-72B-Instruct');
128
120
 
129
121
  console.log(qwen.capabilities.inferenceProviderLogos);
130
122
  // {
131
- // "together": { svg: "/.../together.svg", png: "/.../together.png" },
132
- // "fireworks-ai": { png: "/.../fireworks-ai.png" },
123
+ // "together": { svg: "https://...cdn.../together.svg", png: "https://...cdn.../together.png" },
124
+ // "fireworks-ai": { svg: "https://...cdn.../fireworks-ai.svg", png: "https://...cdn.../fireworks-ai.png" },
133
125
  // }
134
126
  ```
135
127
 
@@ -332,6 +324,222 @@ const imageModels = await ai.getModels('image');
332
324
 
333
325
  ---
334
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
+
335
543
  ## Configuration
336
544
 
337
545
  API keys are resolved from the constructor config or environment variables (config takes priority):