savings
savings
¶
Savings calculation — compare local inference cost against cloud providers.
Classes¶
ProviderSavings
dataclass
¶
ProviderSavings(provider: str = '', label: str = '', input_cost: float = 0.0, output_cost: float = 0.0, total_cost: float = 0.0, energy_wh: float = 0.0, energy_joules: float = 0.0, flops: float = 0.0)
Savings compared to a single cloud provider.
SavingsSummary
dataclass
¶
SavingsSummary(total_calls: int = 0, total_prompt_tokens: int = 0, total_completion_tokens: int = 0, total_tokens: int = 0, local_cost: float = 0.0, per_provider: List[ProviderSavings] = list(), monthly_projection: Dict[str, float] = dict(), session_start_ts: float = 0.0, session_duration_hours: float = 0.0, avg_cost_per_query: Dict[str, float] = dict(), cloud_agent_equivalent: Dict[str, int] = dict())
Overall savings summary across all cloud providers.
Functions¶
compute_savings
¶
compute_savings(prompt_tokens: int, completion_tokens: int, total_calls: int = 0, session_start: float = 0.0) -> SavingsSummary
Compute savings vs cloud providers given token counts.
Source code in src/openjarvis/server/savings.py
savings_to_dict
¶
savings_to_dict(summary: SavingsSummary) -> Dict[str, Any]