Cost Intelligence

Track spending, forecast bills, get right-sizing recommendations, and set budget alerts.

Current Spend

rf cost
COST SUMMARY — March 2026 (MTD)
════════════════════════════════
Total: $127.40 / $180.00 forecast

SERVICE          PLAN          COST      TREND
web              Pro           $25.00    →
api              Pro           $25.00    →
worker           Standard      $7.00     →
pg-main          Pro           $25.00    →
redis-cache      Standard      $10.00    →
search           Standard      $15.00    →
storage          5.2 GB        $3.40     ↑
bandwidth        38 GB         $12.00    ↑
queues           Standard      $5.00     →

Cost Forecast

rf cost forecast
FORECAST — March 2026
─────────────────────
Current MTD:    $127.40 (16 days)
Projected:      $180.20 (31 days)
Budget:         $200.00
Status:         ✓ Within budget (90% of limit)

Trend: Storage growing 12% week-over-week.
       At this rate, storage will cost $8.50 next month (+$5.10).

Cost Diff

Preview the cost impact of changes before applying them:

rf cost diff --scale api --min 4 --max 20
COST IMPACT
───────────
Current:  api Pro × 2 instances avg = $50/mo
Proposed: api Pro × 4-20 instances = $100-500/mo
Estimate: Based on current traffic, ~6 instances avg = $150/mo

Monthly increase: +$100/mo (estimated)
rf cost diff --upgrade pg-main --plan performance
COST IMPACT
───────────
Current:  pg-main Pro = $25/mo
Proposed: pg-main Performance = $100/mo

Monthly increase: +$75/mo
Benefit: 4x CPU, 4x memory, 10x storage

Right-Sizing Recommendations

rf cost optimize
OPTIMIZATION RECOMMENDATIONS
─────────────────────────────
💰 Potential savings: $32/mo

1. DOWNSIZE worker (Standard → Starter)
   Avg CPU: 8%  Avg Memory: 120MB (of 1GB)
   Saving: $7/mo
   Risk: Low — well within Starter limits

2. DOWNSIZE redis-cache (Standard → Starter)
   Avg memory usage: 45MB (of 1GB)
   Saving: $10/mo
   Risk: Low — cache hit rate won't be affected

3. ENABLE scale-to-zero on staging
   Staging services idle 16 hours/day
   Saving: $15/mo
   Command: rf services scale api --min 0 --env staging

Apply recommendation #1? rf cost optimize apply 1

Cost Per Request

Break down costs to the request level:

rf cost per-request --service api --period 7d
COST PER REQUEST — api (last 7 days)
─────────────────────────────────────
Total requests:    847,230
Total cost:        $6.25 (compute only)
Cost per request:  $0.0000074

Breakdown:
  Compute:    $0.0000051 / request
  Bandwidth:  $0.0000018 / request
  Database:   $0.0000005 / request

Cost Allocation

Tag costs by team, project, or feature:

rf cost tag api --team backend
rf cost tag web --team frontend
rf cost tag pg-main --team backend
rf cost breakdown --by team
COST BY TEAM — March 2026
─────────────────────────
backend:   $67.00 (api, worker, pg-main, redis)
frontend:  $40.00 (web, storage, cdn)
shared:    $20.40 (search, queues)

Budget Alerts

rf budget set 200 --notify email:[email protected] --at 50%,80%,100%
✓ Budget set: $200/mo
  50% alert at $100
  80% alert at $160
  100% alert at $200

Hard Budget Limits

Prevent runaway costs with hard limits:

rf budget set 500 --hard-limit --action scale-down

When the budget is hit, RaidFrame scales non-critical services to their minimum instances. Critical services (marked in config) are never affected.

services:
  api:
    budget:
      critical: true    # Never scale down due to budget
  worker:
    budget:
      critical: false   # Can be scaled down to save costs

Invoice & Billing

# View current invoice
rf billing invoice

# Download past invoices
rf billing invoices --format pdf --output ./invoices/

# View payment methods
rf billing payment-methods

# Usage export for accounting
rf billing export --period 2026-03 --format csv