Files

43 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 <key>` |
| OpenRouter | `GET https://openrouter.ai/api/v1/credits` | `Authorization: Bearer <key>` (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 (303600 s, default 300)
- Soglia gialla/rossa residuo (%) per le barre
- Budget di riferimento DeepSeek ($) per la barra (0 = nessuna barra)
- Mostra/nascondi DeepSeek, OpenRouter