Struct Cost Estimate

View as MarkdownOpen in Claude

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.

pub struct CostEstimate {
    pub total: Option<f64>,
    pub currency: String,
    pub input: Option<f64>,
    pub output: Option<f64>,
    pub cache_read: Option<f64>,
    pub cache_write: Option<f64>,
    pub source: CostSource,
    pub pricing_provider: Option<String>,
    pub pricing_model: Option<String>,
    pub pricing_as_of: Option<String>,
    pub pricing_source: Option<String>,
}

Normalized LLM response cost.

Provider-reported cost is preserved as-is. Model-pricing estimates include source and as-of metadata so downstream systems can audit stale pricing tables without losing a usable estimate.

Fields

total: Option<f64>

Total cost in currency.

currency: String

ISO 4217 currency code for the cost fields.

input: Option<f64>

Uncached prompt/input token cost in currency.

output: Option<f64>

Completion/output token cost in currency.

cache_read: Option<f64>

Prompt cache read cost in currency.

cache_write: Option<f64>

Prompt cache write cost in currency.

source: CostSource

Origin of this cost value.

pricing_provider: Option<String>

Provider associated with the cost or pricing estimate, if known.

pricing_model: Option<String>

Model ID associated with the cost or pricing estimate, if known.

pricing_as_of: Option<String>

Date the pricing value was last verified, if known.

pricing_source: Option<String>

Source URL or label for the pricing value, if known.

Implementations

impl CostEstimate

impl CostEstimate

total_or_component_sum

pub fn total_or_component_sum(&self) -> Option<f64>

Returns the explicit total, or the sum of component costs when no total was supplied.

total_for_currency

pub fn total_for_currency(&self, currency: &str) -> Option<f64>

Returns the total only when it is denominated in the requested currency.

total_or_component_sum_for_currency

pub fn total_or_component_sum_for_currency(&self, currency: &str) -> Option<f64>

Returns the explicit or component-derived total in the requested currency.

Trait Implementations

impl Clone for CostEstimate

impl Clone for CostEstimate

clone

fn clone(&self) -> CostEstimate

clone_from

fn clone_from(&mut self, source: &Self)

impl Debug for CostEstimate

impl Debug for CostEstimate

fmt

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<'de> Deserialize<'de> for CostEstimate

impl<'de> Deserialize<'de> for CostEstimate

deserialize

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,

impl PartialEq for CostEstimate

impl PartialEq for CostEstimate

eq

fn eq(&self, other: &CostEstimate) -> bool

ne

fn ne(&self, other: &Rhs) -> bool

impl Serialize for CostEstimate

impl Serialize for CostEstimate

serialize

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where
    __S: Serializer,

impl StructuralPartialEq for CostEstimate

impl StructuralPartialEq for CostEstimate