# AI Credits Balance Plasmoide (widget) per KDE Plasma 6 che mostra il **credito residuo** di **DeepSeek** e **OpenRouter**, leggendo le chiavi API da `~/.pi/agent/auth.json` (i provider `deepseek` e `openrouter` del pi agent). ![dashboard](assets/repository-avatar.png) ## Dati mostrati - **DeepSeek** — saldo totale (`total_balance`), scomposto in `granted` + `top-up`, con badge di disponibilità (`is_available`). Barra opzionale calcolata su un budget di riferimento configurabile. - **OpenRouter** — credito residuo (`total_credits - total_usage`), usato / totale e percentuale residua con barra. ## Sorgenti API | Servizio | Endpoint | Autenticazione | |-------------|-------------------------------------------|--------------------------| | DeepSeek | `GET https://api.deepseek.com/user/balance` | `Authorization: Bearer ` | | OpenRouter | `GET https://openrouter.ai/api/v1/credits` | `Authorization: Bearer ` (management key) | > **Nota OpenRouter:** l'endpoint `/api/v1/credits` richiede una *management key*. Una routing key normale può restituire un errore di autorizzazione. ## Installazione ```bash # copia in ~/.local/share/plasma/plasmoids/ (riavvio plasmashell) cp -r org.enne2.ai-credits.balance ~/.local/share/plasmoids/ systemctl --user restart plasma-plasmashell.service # poi "Aggiungi widget" → "Credito AI Residuo" ``` Oppure via `kpackagetool6`: ```bash kpackagetool6 -t Plasma/Applet -i org.enne2.ai-credits.balance.tar.gz ``` ## Configurazione Dal plasmoide → **Impostazioni**: - Intervallo di aggiornamento (30–3600 s, default 300) - Soglia gialla/rossa residuo (%) per le barre - Budget di riferimento DeepSeek ($) per la barra (0 = nessuna barra) - Mostra/nascondi DeepSeek, OpenRouter