dsh-cost-guard: DSH Cost Plugin for DeepSeek Pure API
dsh-cost-guard is a DSH cost plugin for DeepSeek API usage, licensed under MIT. It focuses on cost control with distinct responsibilities from routing and persona plugins, providing session cost accounting, cache hit rate statistics, and budget hard caps. Core features include: intercepting new requests via `llm/stream` to stop billing after setting a budget (excluding in-flight requests); providing session-level convergence switches to optimize expression; implementing automatic cost routing based on complexity, peak-valley loads, and budget surplus; and supporting peak-valley awareness and off-peak task queues to leverage idle time for automatic task execution. Additionally, the plugin includes a client monitoring dashboard, multi-level budget scope management, and the `dsh-optab` subpackage (for prefix thinning and output compression). The plugin is zero-dependency and does not touch internal state, aiming to help API-only users with unified cost monitoring.
Read More