pub struct CallCost {
pub provider: String,
pub model: String,
pub local: bool,
pub input_tokens: u64,
pub cache_read_tokens: u64,
pub cache_write_tokens: u64,
pub output_tokens: u64,
pub prices: TokenPrices,
pub cost_usd: f64,
pub uncached_cost_usd: f64,
}Expand description
One measured provider turn, priced.
Fields§
§provider: String§model: String§local: boolServed by a local endpoint: nothing is bought, no alarm.
input_tokens: u64§cache_read_tokens: u64§cache_write_tokens: u64§output_tokens: u64§prices: TokenPrices§cost_usd: f64What the turn cost: the provider’s own charge when reported, else the table price of the four token classes.
uncached_cost_usd: f64What the same tokens cost with every prompt token at the input rate.
Implementations§
Source§impl CallCost
impl CallCost
Sourcepub fn priced(
provider: &str,
model: &str,
local: bool,
input_tokens: u64,
cache_read_tokens: u64,
cache_write_tokens: u64,
output_tokens: u64,
prices: TokenPrices,
measured_usd: Option<f64>,
) -> Self
pub fn priced( provider: &str, model: &str, local: bool, input_tokens: u64, cache_read_tokens: u64, cache_write_tokens: u64, output_tokens: u64, prices: TokenPrices, measured_usd: Option<f64>, ) -> Self
Prices one turn with prices; measured_usd (the provider’s own
charge) wins over the table price.
Trait Implementations§
impl StructuralPartialEq for CallCost
Auto Trait Implementations§
impl Forget for CallCost
impl Freeze for CallCost
impl Move for CallCost
impl RefUnwindSafe for CallCost
impl Send for CallCost
impl Sync for CallCost
impl Unpin for CallCost
impl UnsafeUnpin for CallCost
impl UnwindSafe for CallCost
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more