Files
Sankofa/docs/tenants/BILLING_GUIDE.md
defiQUG 9daf1fd378 Apply Composer changes: comprehensive API updates, migrations, middleware, and infrastructure improvements
- Add comprehensive database migrations (001-024) for schema evolution
- Enhance API schema with expanded type definitions and resolvers
- Add new middleware: audit logging, rate limiting, MFA enforcement, security, tenant auth
- Implement new services: AI optimization, billing, blockchain, compliance, marketplace
- Add adapter layer for cloud integrations (Cloudflare, Kubernetes, Proxmox, storage)
- Update Crossplane provider with enhanced VM management capabilities
- Add comprehensive test suite for API endpoints and services
- Update frontend components with improved GraphQL subscriptions and real-time updates
- Enhance security configurations and headers (CSP, CORS, etc.)
- Update documentation and configuration files
- Add new CI/CD workflows and validation scripts
- Implement design system improvements and UI enhancements
2025-12-12 18:01:35 -08:00

4.5 KiB

Billing Guide - Superior to Azure Cost Management

Comprehensive billing and cost management guide for Sankofa Phoenix.

Overview

Sankofa Phoenix billing system provides features superior to Azure Cost Management:

  • Per-second granularity (vs Azure's hourly)
  • Real-time cost tracking (better than Azure)
  • ML-based forecasting (predictive analytics)
  • Blockchain-backed billing (immutable audit trail)
  • Multi-currency support
  • Custom pricing models

Usage Tracking

Per-Second Granularity

Unlike Azure's hourly billing, Sankofa tracks usage per-second:

query {
  usage(
    tenantId: "tenant-id"
    timeRange: {
      start: "2024-01-01T00:00:00Z"
      end: "2024-01-01T23:59:59Z"
    }
    granularity: SECOND
  ) {
    totalCost
    currency
    byResource {
      resourceId
      resourceName
      cost
      quantity
    }
  }
}

Granularity Options

  • SECOND: Per-second tracking (most detailed)
  • MINUTE: Per-minute aggregation
  • HOUR: Per-hour aggregation (Azure equivalent)
  • DAY: Daily aggregation

Cost Breakdown

Get detailed cost breakdown with flexible grouping:

query {
  costBreakdown(
    tenantId: "tenant-id"
    groupBy: ["resource", "service", "region"]
  ) {
    total
    byResource {
      resourceId
      resourceName
      cost
      percentage
    }
    byService {
      service
      cost
      percentage
    }
    byRegion {
      region
      cost
      percentage
    }
    allocations {
      key
      value
      cost
      percentage
    }
  }
}

Cost Forecasting

ML-based cost forecasting (better than Azure):

query {
  costForecast(
    tenantId: "tenant-id"
    timeframe: "30D"
    confidence: 0.8
  ) {
    currentCost
    predictedCost
    confidence
    trend
    recommendations
  }
}

Cost Optimization

Get optimization recommendations:

query {
  costOptimization(tenantId: "tenant-id") {
    id
    type
    title
    description
    potentialSavings
    impact
    effort
  }
}

Budgets

Set and manage budgets (more granular than Azure):

mutation {
  setBudget(
    tenantId: "tenant-id"
    budget: {
      name: "Monthly Budget"
      amount: 10000
      currency: "USD"
      period: MONTHLY
      startDate: "2024-01-01T00:00:00Z"
      alertThresholds: [0.5, 0.75, 0.9]
      filters: {
        resourceType: "VM"
        region: "us-west"
      }
    }
  ) {
    id
    name
    currentSpend
    remaining
  }
}

Billing Alerts

Configure alerts (more flexible than Azure):

mutation {
  createBillingAlert(
    tenantId: "tenant-id"
    alert: {
      name: "High Spending Alert"
      alertType: THRESHOLD
      threshold: 5000
      condition: {
        operator: "greater_than"
        value: 5000
      }
      notificationChannels: ["email", "slack"]
      enabled: true
    }
  ) {
    id
    name
    enabled
  }
}

Invoices

View and manage invoices:

query {
  invoices(
    tenantId: "tenant-id"
    filter: {
      status: PENDING
      startDate: "2024-01-01T00:00:00Z"
      endDate: "2024-01-31T23:59:59Z"
    }
  ) {
    id
    invoiceNumber
    total
    status
    dueDate
    lineItems {
      description
      quantity
      unitPrice
      total
    }
  }
}

Reserved Capacity

Manage reserved instances (more flexible than Azure):

Reserved capacity is tracked in the database and automatically applied to usage calculations.

Discounts

Custom discount rules per tenant:

Discounts can be configured with:

  • Percentage-based
  • Fixed amount
  • Volume discounts
  • Tier-based discounts

Blockchain Integration

All billing records are optionally recorded on blockchain for:

  • Immutable audit trail
  • Multi-party verification
  • Transparent cost breakdown
  • Automated settlement

Comparison to Azure Cost Management

Feature Azure Sankofa Phoenix
Billing Granularity Hourly Per-second
Real-time Tracking Limited Full real-time
Cost Forecasting Basic ML-based
Optimization Manual Automated recommendations
Blockchain No Yes (unique)
Multi-currency Limited Full support
Custom Pricing Limited Per-tenant models

Best Practices

  1. Set budgets early: Configure budgets before deployment
  2. Use alerts: Set up alerts for cost thresholds
  3. Review regularly: Check cost breakdown weekly
  4. Optimize continuously: Use optimization recommendations
  5. Monitor trends: Use forecasting to plan capacity