Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions api/v1alpha1/costprofile_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,31 @@ type ElectricitySpec struct {
IdleWattsThreshold *float64 `json:"idleWattsThreshold,omitempty"`
}

// CloudTarget names a specific cloud provider + model to compute break-even
// against. Both must match an entry in the bundled cloud pricing catalog
// (case-insensitive); unknown targets are skipped and surfaced via a status
// condition rather than silently ignored.
type CloudTarget struct {
// provider is the cloud provider name (e.g. "anthropic", "openai", "google").
// +kubebuilder:validation:MinLength=1
Provider string `json:"provider"`

// model is the cloud model id (e.g. "claude-sonnet-4-6", "gpt-5.4-nano").
// +kubebuilder:validation:MinLength=1
Model string `json:"model"`
}

// CloudComparisonSpec selects which cloud models the break-even analysis is
// computed against for workloads covered by this profile.
type CloudComparisonSpec struct {
// targets is the list of cloud provider+model pairs to compare against.
// Choose models comparable to what you self-host (a small coder model
// breaks even against a budget cloud model, not a flagship). When omitted,
// InferCost defaults to one mid-tier model per provider.
// +optional
Targets []CloudTarget `json:"targets,omitempty"`
}

// CostProfileSpec defines the hardware economics for computing inference costs.
type CostProfileSpec struct {
// hardware declares GPU hardware cost parameters.
Expand All @@ -89,6 +114,11 @@ type CostProfileSpec struct {
// If omitted, all namespaces on matching nodes are included.
// +optional
NamespaceSelector map[string]string `json:"namespaceSelector,omitempty"`

// cloudComparison selects which cloud models the break-even analysis compares
// against. When omitted, a sensible mid-tier default per provider is used.
// +optional
CloudComparison *CloudComparisonSpec `json:"cloudComparison,omitempty"`
}

// CostProfileStatus defines the computed state of a CostProfile.
Expand Down
32 changes: 32 additions & 0 deletions api/v1alpha1/usagereport_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ type UsageReportStatus struct {
// +optional
CloudComparison []CloudComparisonEntry `json:"cloudComparison,omitempty"`

// breakEvenAnalysis reports, per configured cloud target, the daily token
// volume at which on-prem cost equals the cloud cost, and how current
// throughput compares. Answers "at what volume does on-prem beat the cloud?"
// +optional
BreakEvenAnalysis []BreakEvenEntry `json:"breakEvenAnalysis,omitempty"`

// lastUpdated is the timestamp of the last report computation.
// +optional
LastUpdated *metav1.Time `json:"lastUpdated,omitempty"`
Expand All @@ -208,13 +214,39 @@ type UsageReportStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// BreakEvenEntry reports, for one cloud target, the daily token volume at which
// on-prem cost equals that cloud model's cost, and how current throughput compares.
type BreakEvenEntry struct {
// provider is the cloud provider compared against.
Provider string `json:"provider"`

// model is the cloud model compared against.
Model string `json:"model"`

// breakEvenTokensPerDay is the daily token volume at which on-prem cost
// equals this cloud model's cost. Above it, on-prem is cheaper.
BreakEvenTokensPerDay int64 `json:"breakEvenTokensPerDay"`

// currentUtilizationTokensPerDay is current throughput extrapolated to a full day.
CurrentUtilizationTokensPerDay int64 `json:"currentUtilizationTokensPerDay"`

// percentOfBreakEven is currentUtilizationTokensPerDay / breakEvenTokensPerDay
// as a percentage (>= 100 means on-prem is at or past break-even).
PercentOfBreakEven float64 `json:"percentOfBreakEven"`

// verdict summarizes the comparison at current utilization
// ("on-prem-cheaper-at-current-utilization" or "cloud-cheaper-at-current-utilization").
Verdict string `json:"verdict"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Period",type=string,JSONPath=`.status.period`
// +kubebuilder:printcolumn:name="Cost ($)",type=number,JSONPath=`.status.estimatedCostUSD`,format=float
// +kubebuilder:printcolumn:name="$/MTok",type=number,JSONPath=`.status.costPerMillionTokens`,format=float
// +kubebuilder:printcolumn:name="$/MTok (marginal)",type=number,JSONPath=`.status.marginalCostPerMillionTokens`,format=float,priority=1
// +kubebuilder:printcolumn:name="$/MTok (active)",type=number,JSONPath=`.status.activeHoursCostPerMillionTokens`,format=float,priority=1
// +kubebuilder:printcolumn:name="Break-even %",type=number,JSONPath=`.status.breakEvenAnalysis[0].percentOfBreakEven`,format=float,priority=1
// +kubebuilder:printcolumn:name="Input Tokens",type=integer,JSONPath=`.status.inputTokens`
// +kubebuilder:printcolumn:name="Output Tokens",type=integer,JSONPath=`.status.outputTokens`
// +kubebuilder:printcolumn:name="Util %",type=number,JSONPath=`.status.utilizationPercent`,format=float,priority=1
Expand Down
60 changes: 60 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions charts/infercost/templates/crds/costprofiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,40 @@ spec:
description: CostProfileSpec defines the hardware economics for computing
inference costs.
properties:
cloudComparison:
description: |-
cloudComparison selects which cloud models the break-even analysis compares
against. When omitted, a sensible mid-tier default per provider is used.
properties:
targets:
description: |-
targets is the list of cloud provider+model pairs to compare against.
Choose models comparable to what you self-host (a small coder model
breaks even against a budget cloud model, not a flagship). When omitted,
InferCost defaults to one mid-tier model per provider.
items:
description: |-
CloudTarget names a specific cloud provider + model to compute break-even
against. Both must match an entry in the bundled cloud pricing catalog
(case-insensitive); unknown targets are skipped and surfaced via a status
condition rather than silently ignored.
properties:
model:
description: model is the cloud model id (e.g. "claude-sonnet-4-6",
"gpt-5.4-nano").
minLength: 1
type: string
provider:
description: provider is the cloud provider name (e.g. "anthropic",
"openai", "google").
minLength: 1
type: string
required:
- model
- provider
type: object
type: array
type: object
electricity:
description: electricity declares electricity cost parameters.
properties:
Expand Down
51 changes: 51 additions & 0 deletions charts/infercost/templates/crds/usagereports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ spec:
name: $/MTok (active)
priority: 1
type: number
- format: float
jsonPath: .status.breakEvenAnalysis[0].percentOfBreakEven
name: Break-even %
priority: 1
type: number
- jsonPath: .status.inputTokens
name: Input Tokens
type: integer
Expand Down Expand Up @@ -131,6 +136,52 @@ spec:
power draw above the idle threshold. Paired with totalHoursInPeriod so
operators can see the ratio without recomputing.
type: number
breakEvenAnalysis:
description: |-
breakEvenAnalysis reports, per configured cloud target, the daily token
volume at which on-prem cost equals the cloud cost, and how current
throughput compares. Answers "at what volume does on-prem beat the cloud?"
items:
description: |-
BreakEvenEntry reports, for one cloud target, the daily token volume at which
on-prem cost equals that cloud model's cost, and how current throughput compares.
properties:
breakEvenTokensPerDay:
description: |-
breakEvenTokensPerDay is the daily token volume at which on-prem cost
equals this cloud model's cost. Above it, on-prem is cheaper.
format: int64
type: integer
currentUtilizationTokensPerDay:
description: currentUtilizationTokensPerDay is current throughput
extrapolated to a full day.
format: int64
type: integer
model:
description: model is the cloud model compared against.
type: string
percentOfBreakEven:
description: |-
percentOfBreakEven is currentUtilizationTokensPerDay / breakEvenTokensPerDay
as a percentage (>= 100 means on-prem is at or past break-even).
type: number
provider:
description: provider is the cloud provider compared against.
type: string
verdict:
description: |-
verdict summarizes the comparison at current utilization
("on-prem-cheaper-at-current-utilization" or "cloud-cheaper-at-current-utilization").
type: string
required:
- breakEvenTokensPerDay
- currentUtilizationTokensPerDay
- model
- percentOfBreakEven
- provider
- verdict
type: object
type: array
byModel:
description: byModel contains per-model cost breakdowns.
items:
Expand Down
34 changes: 34 additions & 0 deletions config/crd/bases/finops.infercost.ai_costprofiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,40 @@ spec:
description: CostProfileSpec defines the hardware economics for computing
inference costs.
properties:
cloudComparison:
description: |-
cloudComparison selects which cloud models the break-even analysis compares
against. When omitted, a sensible mid-tier default per provider is used.
properties:
targets:
description: |-
targets is the list of cloud provider+model pairs to compare against.
Choose models comparable to what you self-host (a small coder model
breaks even against a budget cloud model, not a flagship). When omitted,
InferCost defaults to one mid-tier model per provider.
items:
description: |-
CloudTarget names a specific cloud provider + model to compute break-even
against. Both must match an entry in the bundled cloud pricing catalog
(case-insensitive); unknown targets are skipped and surfaced via a status
condition rather than silently ignored.
properties:
model:
description: model is the cloud model id (e.g. "claude-sonnet-4-6",
"gpt-5.4-nano").
minLength: 1
type: string
provider:
description: provider is the cloud provider name (e.g. "anthropic",
"openai", "google").
minLength: 1
type: string
required:
- model
- provider
type: object
type: array
type: object
electricity:
description: electricity declares electricity cost parameters.
properties:
Expand Down
51 changes: 51 additions & 0 deletions config/crd/bases/finops.infercost.ai_usagereports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ spec:
name: $/MTok (active)
priority: 1
type: number
- format: float
jsonPath: .status.breakEvenAnalysis[0].percentOfBreakEven
name: Break-even %
priority: 1
type: number
- jsonPath: .status.inputTokens
name: Input Tokens
type: integer
Expand Down Expand Up @@ -130,6 +135,52 @@ spec:
power draw above the idle threshold. Paired with totalHoursInPeriod so
operators can see the ratio without recomputing.
type: number
breakEvenAnalysis:
description: |-
breakEvenAnalysis reports, per configured cloud target, the daily token
volume at which on-prem cost equals the cloud cost, and how current
throughput compares. Answers "at what volume does on-prem beat the cloud?"
items:
description: |-
BreakEvenEntry reports, for one cloud target, the daily token volume at which
on-prem cost equals that cloud model's cost, and how current throughput compares.
properties:
breakEvenTokensPerDay:
description: |-
breakEvenTokensPerDay is the daily token volume at which on-prem cost
equals this cloud model's cost. Above it, on-prem is cheaper.
format: int64
type: integer
currentUtilizationTokensPerDay:
description: currentUtilizationTokensPerDay is current throughput
extrapolated to a full day.
format: int64
type: integer
model:
description: model is the cloud model compared against.
type: string
percentOfBreakEven:
description: |-
percentOfBreakEven is currentUtilizationTokensPerDay / breakEvenTokensPerDay
as a percentage (>= 100 means on-prem is at or past break-even).
type: number
provider:
description: provider is the cloud provider compared against.
type: string
verdict:
description: |-
verdict summarizes the comparison at current utilization
("on-prem-cheaper-at-current-utilization" or "cloud-cheaper-at-current-utilization").
type: string
required:
- breakEvenTokensPerDay
- currentUtilizationTokensPerDay
- model
- percentOfBreakEven
- provider
- verdict
type: object
type: array
byModel:
description: byModel contains per-model cost breakdowns.
items:
Expand Down
Loading