Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(inference): move provider types into dedicated module

Steven Enamakele4c5675dd77c
diff --git a/crates/openhuman-core/src/inference/provider/types.rs b/crates/openhuman-core/src/inference/provider/types.rs
index b47f4e56ec..bd53b5fb00 100644
--- a/crates/openhuman-core/src/inference/provider/types.rs
+++ b/crates/openhuman-core/src/inference/provider/types.rs
@@ -72,18 +72,30 @@ impl BilledUsage {
self
}
- /// Sets the provider-charged USD amount.
+ /// Records what the provider billed for this call. Zero is a real charge
+ /// (a free route), not "unknown".
pub fn with_charged_usd(mut self, usd: f64) -> Self {
self.charged_amount_usd = usd;
self.cost_is_estimate = false;
+ self.charge_reported = true;
self
}
+ /// Records a charge only when the provider reported one; `None` leaves
+ /// the cost unknown.
+ pub fn with_reported_charge(self, usd: Option<f64>) -> Self {
+ match usd {
+ Some(usd) => self.with_charged_usd(usd),
+ None => self,
+ }
+ }
+
/// Sets a locally estimated USD cost, kept apart from provider charges so
/// usage reports can split charged from estimated spend.
pub fn with_estimated_usd(mut self, usd: f64) -> Self {
self.charged_amount_usd = usd;
self.cost_is_estimate = true;
+ self.charge_reported = false;
self
}
}