# πŸ“¦ @goodandready/dsh-model-sync

Dynamic LLM Model Catalog Synchronization & Automated Balance Monitoring for DeepSeek Harness

npm version license DSH Plugin Node version

All Author Projects

πŸ‡¬πŸ‡§ English β€’ πŸ‡·πŸ‡Ί Русский β€’ πŸ‡¨πŸ‡³ δΈ­ζ–‡θ―΄ζ˜Ž

⭐ If you like this plugin, please star it on GitHub β€” it shows me that the plugin is useful to you and motivates me to keep developing it.

πŸ› If you find a bug or would like to request a feature, open a GitHub issue in any language β€” I will review your proposal and implement useful suggestions in a future plugin version.
--- ## ⚑ Overview **`dsh-model-sync`** keeps your **DeepSeek Harness** model catalog up-to-date with upstream AI providers. Instead of manually editing YAML configs whenever a provider launches a new model, adjusts context window limits, or changes pricing, `dsh-model-sync` automatically discovers new releases, updates capability metadata (`vision`, `tools`, `reasoning`, `embeddings`), tracks account balances, manages model selection visibility, and reconciles models on the fly without server restarts. ```mermaid graph LR subgraph Trigger [Scheduling & Manual Trigger] Cron[⏰ Background Polling Scheduler] --> Engine[dsh-model-sync Core Engine] WebUI[πŸ–₯️ Settings: Sync Now Button] --> Engine end subgraph Providers [25+ Upstream Providers] Engine --> Registry{Adapter Registry} Registry -->|Bearer Auth| P1[OpenAI / DeepSeek / OpenRouter / Groq] Registry -->|x-api-key Auth| P2[Anthropic Claude / Custom Gateways] Registry -->|query-key Auth| P3[Google Gemini] Registry -->|Local Probe| P4[Local Ollama / vLLM / SGLang] Registry -->|CommandCode API| P5[Command Code / visibleModels] Registry -->|Plan Discovery| P6[ClineBot Subscription Plan] end subgraph Reconcile [Catalog Reconciler & Auditing] P1 --> Normalizer[Model Normalizer & Capabilities Tagger] P2 --> Normalizer P3 --> Normalizer P4 --> Normalizer P5 --> Normalizer P6 --> Normalizer Normalizer --> Diff[Sync Diff Tracker: Added / Deprecated] Diff --> Catalog[Active DSH Models Catalog & visibleModels] end style Trigger fill:#1e1e2e,stroke:#89b4fa,stroke-width:2px,color:#cdd6f4 style Providers fill:#181825,stroke:#cba6f7,stroke-width:2px,color:#cdd6f4 style Reconcile fill:#11111b,stroke:#a6e3a1,stroke-width:2px,color:#cdd6f4 ``` --- ## ✨ Key Features * 🏷️ **Smart Collections & Catalog Auto-Tagging**: Automatically categorizes models into standardized tags (`coding`, `reasoning`, `fast`, `vision`, `long-context`) during discovery, provides fast pill-button filtering in the Web UI, and introduces a one-click "⭐ Curated Best" selection preset for top flagship models. * ⚑ **Latency TTFT Radar & Sparklines**: Probes response latency and Time To First Token (TTFT) across models, renders ASCII sparklines (` β–‚β–ƒβ–‚ `) and 4-tier speed badges (⚑ `< 300ms`, 🟒 `< 1.2s`, 🟑 `1.5 - 3.0s`, πŸ”΄ `> 3.0s`), and exposes `GET /dsh-model-sync/health/latency` for intelligent downstream routing. * πŸ’Έ **Dynamic Live Pricing Sync & Prompt Caching**: Periodic background updates of live model pricing from OpenRouter and LiteLLM snapshots with persistent disk fallback cache, tracking prompt cache read/write costs (`cacheReadPerToken`, `cacheWritePerToken`), with `GET /dsh-model-sync/pricing` and `POST /dsh-model-sync/pricing/sync` endpoints. * πŸ’° **Built-in Reference Pricing Database**: Canonical token pricing database automatically enriches models for OpenAI, Anthropic, Groq, Mistral, xAI, and DeepSeek, enabling cost-limit filtering and `@cheap` auto-resolution even when upstream APIs omit pricing metadata. * 🎯 **Dynamic Smart Virtual Aliases & Auto-Fallback**: Route requests to virtual aliases like `@fast`, `@cheap`, and `@best-code`, with automatic fallback chains when circuit breakers open or health probes fail. * πŸ“ **Real Context Limits & Boundary Safety (`contextWindow` / `maxOutputTokens`)**: precise separation of input and generation limits, prevention of 400 `max_tokens` errors via auto-clamping, and clear `In: 128k | Out: 8k` badges in Web UI. * 🧠 **Unified Reasoning & Thinking Configuration**: automatic format detection (`effort`, `budget_tokens`, `boolean`) and parameter translation with suppression of incompatible options (such as `temperature` on o1/o3). * πŸ”” **External Diff Webhooks & Event Dispatching**: Real-time webhook notifications with HMAC-SHA256 signature verification and Cordis `model-sync/diff` events when models are added, deprecated, or prices change. * ⚑ **High-Performance Policy Filtering**: Fast-path evaluation in `filterModels` bypasses regular expressions and array filtering when no filtering policy is configured, guaranteeing zero-overhead discovery runs. * πŸ”„ **One-Click In-App Updates**: Built-in update checker in Settings with automatic npm cache bypass on demand (`?fresh=1` / `Cache-Control: no-cache`), ensuring instantaneous discovery of new package releases. * πŸ”„ **Automated Catalog Discovery**: Syncs model lists, aliases, context windows, and capability flags (`vision`, `tools`, `reasoning`, `embeddings`) across 25+ providers. * πŸ›‘οΈ **Minijinja Chat Template & Role Compatibility**: Automatically sets `compat.supportsDeveloperRole: false` for Groq open-source models (Qwen, Llama, Mistral, Gemma, DeepSeek) and DeepSeek API, preventing 400 `Unexpected message role` errors with reasoning models while preserving user overrides. * 🌐 **25+ Built-in Provider Adapters**: Pre-configured discovery for OpenAI, Anthropic, Google, DeepSeek, xAI, OpenRouter, Groq, Mistral, Cerebras, Fireworks, HuggingFace, Moonshot, NVIDIA, Qwen, Together, Xiaomi MiMo, SiliconFlow, Command Code, ClineBot, and local Ollama. * πŸŽ›οΈ **Command Code Model Selection**: Full discovery of Command Code models with granular checkbox selection in the UI, automatically syncing `visibleModels` to `llm-commandcode` settings. * 🎯 **ClineBot Subscription Plan Sync**: Dedicated adapter querying `GET /users/me/plan` to discover only active subscription-included models, eliminating catalog clutter from out-of-plan endpoints. * πŸ”Œ **Generic / Custom Adapter Support**: Connect arbitrary OpenAI-compatible `/v1/models` endpoints with configurable auth (`bearer`, `x-api-key`, `query-key`, `none`). * πŸ“Š **Balance & Quota Monitoring**: Queries upstream billing endpoints (where supported) to report account credit balances and prevent unexpected exhaustion. * πŸ“œ **Sync History & Diff Auditing**: Tracks all newly discovered models, deprecated IDs, and modified capabilities with timestamped diff logs in the Web UI. * πŸ–₯️ **Full Web GUI Panel (**Settings β†’ Model Synchronization**)**: * Live status cards per provider with active model counters; * Instant "Sync Now" button for on-demand catalog refreshes; * Granular model checkboxes for selection and visibility management; * Provider enable/disable toggles and custom endpoint inputs. --- ## πŸ› οΈ Supported Discovery Providers | Provider Identifier | Authentication Format | Capabilities Auto-Detection & Notes | |---|---|---| | `openai` | Bearer Token | `vision`, `tools`, `reasoning`, `embeddings` | | `anthropic` | `x-api-key` header | `vision`, `tools`, `reasoning` | | `google` | Query parameter / Key | `vision`, `tools`, `reasoning`, `embeddings` | | `deepseek` | Bearer Token | `tools`, `reasoning` | | `xai` | Bearer Token | `vision`, `tools`, `reasoning` | | `openrouter` | Bearer Token | Multi-vendor model catalog with pricing & context limits | | `groq` | Bearer Token | `tools`, `reasoning`, `vision`, `supportsDeveloperRole: false` | | `mistral` | Bearer Token | `tools`, `reasoning`, `vision` | | `commandcode` | Bearer Token | `https://api.commandcode.ai/provider/v1/models` catalog with `visibleModels` selection syncing to `llm-commandcode` | | `clinebot` | Bearer Token | Active subscription plan discovery (`/users/me/plan`), restricting sync strictly to plan-included models | | `fireworks` | Bearer Token | Open-weights inference endpoints | | `huggingface` | Bearer Token | Serverless Inference API catalog | | `together` | Bearer Token | Open-source model catalog | | `ollama` | Local HTTP (`none`) | Local offline model discovery (`/api/tags`) | | `custom` | Configurable | Any custom OpenAI or Google compatible gateway | --- ## πŸ“¦ Quick Installation ```bash dsh plugin --profile web add @goodandready/dsh-model-sync ``` > [!IMPORTANT] > Restart DSH Web UI after installation (`systemctl --user restart dsh-web`) to activate background catalog synchronization. --- ## βš™οΈ Configuration (`settings.yaml`) ```yaml dsh-model-sync: enabled: true scheduleEnabled: false intervalMinutes: 60 autoApply: false requestTimeoutMs: 15000 retryAttempts: 3 concurrency: 4 providers: - provider: commandcode enabled: true autoApply: false - provider: clinebot enabled: true autoApply: false ``` | Parameter | Type | Default | Description | |---|---|---|---| | `enabled` | `boolean` | `true` | Master switch for background synchronization | | `scheduleEnabled` | `boolean` | `false` | Enable periodic background synchronization schedule | | `intervalMinutes` | `number` | `60` | Polling frequency for catalog refreshes in minutes | | `autoApply` | `boolean` | `false` | Automatically apply discovered models to active catalog | | `requestTimeoutMs`| `number` | `15000` | HTTP request timeout for catalog fetching (ms) | | `retryAttempts` | `number` | `3` | Maximum retry attempts for transient network failures | | `concurrency` | `number` | `4` | Maximum parallel provider synchronization workers | | `providers` | `array` | `[]` | Per-provider configuration list (`provider`, `enabled`, `autoApply`) | --- ### πŸ” Active Capability Probing & Verification - **Micro-Probes**: Accurately test actual model capabilities rather than relying on declared flags: - `JSON Schema`: Tests structured output generation (`response_format: { type: "json_schema" }`). - `Tools / Functions`: Tests function call generation and parameter handling. - `Vision`: Tests multimodal processing with lightweight image payloads. - `Developer Role`: Validates `developer` role prompt acceptance for advanced reasoning models. - **UI Actions**: One-click "πŸ” Verify Capabilities" on any provider card, plus global "πŸ” Verify All Models" and "⚑ Verify New Only" buttons in catalog toolbar. - **Verified Badges**: Highlights confirmed features with green indicators (`βœ” Tools`, `βœ” Vision`, `βœ” JSON`, `βœ” DevRole`) persisted across restarts. ### πŸ¦™ Ollama & Local Engine Hub - **Direct Web Management**: Pull, monitor, and manage local Ollama models directly from DSH Web UI without SSH. - **Streaming Pull Progress**: Real-time layer download progress bar with speed and transferred byte metrics. - **GPU VRAM Management**: Displays active models in VRAM (`/api/ps`) and provides instant "⏏ Unload from VRAM" (`keep_alive: 0`) to free GPU resources. - **Architecture & Quantization**: Displays quantization levels (`Q4_K_M`, `Q8_0`), family, context windows, and offers direct deletion. --- ## πŸ“„ License MIT Β© [GooDAnDReaDY](https://github.com/GooDAnDReaDY)