pub struct AgentCost {
pub input_tokens: u64,
pub output_tokens: u64,
pub cache_read_tokens: u64,
pub cache_creation_tokens: u64,
pub total_usd: f64,
}Expand description
Cost breakdown for a single query or session.
cache_read_tokens and cache_creation_tokens were added in 0.2.0 to
surface Anthropic prompt-caching effects. They default to 0 for providers
that don’t report cache stats (Codex, OpenCode today).
Fields§
§input_tokens: u64§output_tokens: u64§cache_read_tokens: u64Tokens served from prompt cache (cheap reads).
cache_creation_tokens: u64Tokens written to the prompt cache (one-off cost).
total_usd: f64Trait Implementations§
Source§impl<'de> Deserialize<'de> for AgentCost
impl<'de> Deserialize<'de> for AgentCost
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentCost, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentCost, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for AgentCost
impl Serialize for AgentCost
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for AgentCost
impl RefUnwindSafe for AgentCost
impl Send for AgentCost
impl Sync for AgentCost
impl Unpin for AgentCost
impl UnsafeUnpin for AgentCost
impl UnwindSafe for AgentCost
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