---
name: cost-tracker
description: Monitor and track infrastructure costs including VPS, API usage, domains, and cloud services. Alert on unusual spending patterns.
---

# Cost Tracker Skill

Track all infrastructure and service costs to optimize spending.

## Cost Categories

### 1. VPS/Servers
| Provider | Service | Monthly Cost | Notes |
|----------|---------|--------------|-------|
| Oracle | VPS 60 | Free tier | ARM 4 OCPU, 24GB RAM |
| Oracle | VPS 137 | Free tier | ARM 4 OCPU, 24GB RAM |
| Oracle | VPS 227 | Free tier | ARM 4 OCPU, 24GB RAM |

### 2. Domains
| Domain | Registrar | Annual Cost | Renewal Date |
|--------|-----------|-------------|--------------|
| zesbe.my.id | - | ~Rp 150k | Check |
| yudhalabs.dev | - | ~Rp 200k | Check |
| hallowa.id | - | ~Rp 150k | Check |
| bersamateman.vip | - | ~Rp 300k | Check |

### 3. API Services
| Service | Plan | Monthly Cost | Usage |
|---------|------|--------------|-------|
| MiniMax | Pay-per-use | Variable | Music generation |
| Cloudflare | Free | $0 | Tunnels, DNS |
| GitHub | Free | $0 | Private repos |

### 4. Potential Costs
| Service | If Used | Cost |
|---------|---------|------|
| 360dialog | Growth Plan | €500/mo (~Rp 10jt) |
| Meta Direct | Tech Provider | Free (conversation fees) |

## Cost Report Template

```
💰 MONTHLY COST REPORT
Period: January 2026

┌─────────────────────────────────────────────┐
│ Infrastructure                              │
├─────────────────────────────────────────────┤
│ VPS (Oracle Free Tier)         Rp        0  │
│ Domains (annual/12)            Rp   66,667  │
│ SSL Certificates               Rp        0  │
│ Cloudflare                     Rp        0  │
├─────────────────────────────────────────────┤
│ Subtotal                       Rp   66,667  │
└─────────────────────────────────────────────┘

┌─────────────────────────────────────────────┐
│ API Usage                                   │
├─────────────────────────────────────────────┤
│ MiniMax (56 generations)       Rp  280,000  │
│ Other APIs                     Rp        0  │
├─────────────────────────────────────────────┤
│ Subtotal                       Rp  280,000  │
└─────────────────────────────────────────────┘

┌─────────────────────────────────────────────┐
│ TOTAL MONTHLY                  Rp  346,667  │
└─────────────────────────────────────────────┘

Compared to last month: ↑ 15% (more AI generations)
```

## API Usage Tracking

### MiniMax API
```bash
# Track API calls
grep "minimax" /var/log/rima/api.log | wc -l

# Estimate cost
# Music generation: ~$0.05 per generation
# 56 generations = ~$2.80 = ~Rp 45,000
```

### Cost Per Feature
```
Rima Music Generation:
- MiniMax API call: ~Rp 5,000/generation
- Storage (audio file): ~Rp 100/file
- Total per generation: ~Rp 5,100
```

## Budget Alerts

```yaml
alerts:
  - name: "API spending spike"
    condition: "daily_api_cost > 2x average"
    action: "telegram_alert"

  - name: "Domain expiring"
    condition: "days_until_expiry < 30"
    action: "telegram_alert"

  - name: "Free tier limit"
    condition: "oracle_usage > 80%"
    action: "telegram_alert"
```

## Cost Optimization Tips

### Already Optimized ✅
- Using Oracle Free Tier (saves ~$50-100/mo)
- Cloudflare Free (saves ~$20/mo)
- GitHub Free for private repos

### Potential Savings
- Batch AI generations (reduce API calls)
- Compress audio files (reduce storage)
- Cache API responses (reduce duplicate calls)

## Tracking Commands

```bash
# Check Oracle usage
oci usage get --tenant-id $TENANT

# Check domain expiry
whois zesbe.my.id | grep -i expir

# Check Cloudflare usage
curl -X GET "https://api.cloudflare.com/client/v4/user/billing/history"
```

## Integration with Proactive Mode

Monthly:
1. Calculate all costs
2. Compare to budget
3. Identify anomalies
4. Suggest optimizations
5. Alert on unusual spending

Triggers:
- API cost > 2x daily average
- Domain expiring < 30 days
- Free tier approaching limit
