Platform Security Observability FinOps Compliance Evaluations AI Gateway Shadow AI
Solutions Enterprise AI Governance Custom Agent Security Financial Services Healthcare Technology
Docs Blog Book a Demo

Platform

FinOps & Cost Management

Track, optimize, and control AI spending with Saf3AI's FinOps features.

FinOps & Cost Management

AI costs can grow rapidly and unpredictably. Saf3AI’s FinOps features help you understand, control, and optimize your AI spending.

Cost Tracking

Automatic Cost Calculation

We automatically calculate costs for:

  • All major LLM providers (OpenAI, Anthropic, Google, Cohere, etc.)
  • Input and output tokens
  • Model-specific pricing
  • API call overhead
# Costs are tracked automatically
with saf3.trace("agent") as trace:
    response = openai.chat.completions.create(...)
    # trace.cost now contains accurate cost data

Multi-Provider Support

Track costs across all providers in one dashboard:

ProviderModelsPricing Updated
OpenAIGPT-4, GPT-3.5, EmbeddingsReal-time
AnthropicClaude 3, Claude 2Real-time
GoogleGemini, PaLMReal-time
Azure OpenAIAll Azure modelsReal-time
AWS BedrockTitan, Claude, LlamaReal-time
CohereCommand, EmbedReal-time

Cost Attribution

Per-Agent Costs

See exactly how much each agent costs:

with saf3.trace("support-agent") as trace:
    # All costs attributed to "support-agent"
    pass

with saf3.trace("research-agent") as trace:
    # All costs attributed to "research-agent"
    pass

Per-User Costs

Track costs by user:

with saf3.trace("agent", user_id="user-123") as trace:
    pass

Per-Feature Costs

Attribute costs to product features:

with saf3.trace("agent", metadata={"feature": "chat"}) as trace:
    pass

Cost Breakdown

The dashboard shows:

  • Cost by model
  • Cost by agent
  • Cost by user/team
  • Cost by feature
  • Cost by time period

Budget Management

Setting Budgets

Create budgets at any level:

# Organization budget
saf3.budgets.create(
    name="monthly-org",
    amount=10000,  # $10,000
    period="monthly",
    alert_thresholds=[50, 80, 100]
)

# Per-agent budget
saf3.budgets.create(
    name="support-agent-daily",
    amount=100,  # $100/day
    period="daily",
    scope={"agent": "support-agent"}
)

# Per-user budget
saf3.budgets.create(
    name="user-monthly",
    amount=50,  # $50/month per user
    period="monthly",
    scope={"user_id": "*"}  # Applies to each user
)

Budget Alerts

Get notified when spending approaches limits:

# Alerts at 50%, 80%, and 100% of budget
saf3.budgets.create(
    name="team-budget",
    amount=5000,
    period="monthly",
    alert_thresholds=[50, 80, 100],
    channels=["slack", "email"]
)

Hard Limits

Optionally enforce hard spending limits:

saf3.budgets.create(
    name="strict-daily-limit",
    amount=200,
    period="daily",
    enforce=True  # Blocks requests when exceeded
)

Cost Optimization

Token Optimization

Identify opportunities to reduce tokens:

# Get optimization recommendations
recommendations = saf3.finops.get_recommendations(
    scope="last-7-days"
)

# Example recommendations:
# - "Agent X uses 40% more tokens than similar agents"
# - "Consider shorter system prompts for agent Y"
# - "Switch to GPT-3.5 for 20% of queries"

Model Recommendations

We analyze your usage to recommend:

  • Cheaper models for simple tasks
  • When to upgrade to better models
  • Optimal model routing strategies

Caching Insights

Identify cacheable patterns:

# Get caching recommendations
caching = saf3.finops.analyze_caching_potential()

# Example output:
# - "35% of queries are repeated - estimated savings: $500/month"
# - "Enable response caching for agent X"

Forecasting

Spending Forecasts

Predict future costs based on:

  • Historical usage patterns
  • Growth trends
  • Seasonal variations
forecast = saf3.finops.forecast(
    horizon="30d",
    confidence=0.95
)

print(f"Predicted spend: ${forecast.amount} (+/- ${forecast.uncertainty})")

Anomaly Detection

Automatically detect unusual spending:

# Alerts for spending anomalies
saf3.alerts.create(
    name="cost-anomaly",
    condition="daily.cost > baseline * 1.5",
    channels=["slack"]
)

Reporting

Built-in Reports

Generate reports for:

  • Executive summaries
  • Team cost allocation
  • Project cost tracking
  • Audit/compliance

Export Options

Export data to:

  • CSV/Excel
  • PDF reports
  • API access
  • Data warehouse integration

Scheduled Reports

saf3.reports.schedule(
    name="weekly-cost-report",
    type="cost_summary",
    frequency="weekly",
    recipients=["finance@company.com"]
)

Chargeback

Internal Billing

Set up chargeback to teams:

# Attribute costs to cost centers
with saf3.trace(
    "agent",
    metadata={
        "cost_center": "engineering",
        "project": "project-alpha"
    }
) as trace:
    pass

Invoice Generation

Generate invoices for internal teams or customers:

invoices = saf3.finops.generate_invoices(
    period="2024-01",
    group_by="cost_center"
)

Dashboard Features

Cost Explorer

  • Filter by time range, agent, user, model
  • Drill down from org → team → agent → trace
  • Compare periods (month-over-month, etc.)

Budget Dashboard

  • Real-time budget status
  • Projected end-of-period spend
  • Alert history

Optimization Hub

  • Actionable recommendations
  • Estimated savings
  • One-click implementation

Best Practices

1. Set Budgets Early

Don’t wait for a surprise bill. Set budgets on day one:

# Start with conservative limits
saf3.budgets.create(
    name="initial-budget",
    amount=500,
    period="daily",
    alert_thresholds=[50, 80, 100]
)

2. Attribute All Costs

Always include context for attribution:

with saf3.trace(
    "agent",
    user_id=user_id,
    metadata={
        "team": team,
        "feature": feature,
        "environment": env
    }
) as trace:
    pass

3. Review Regularly

Set up weekly cost reviews:

  • Check budget status
  • Review recommendations
  • Adjust allocations

4. Implement Recommendations

Don’t just collect data—act on it:

  • Apply model routing suggestions
  • Enable caching where recommended
  • Optimize prompts for token efficiency

Next Steps