pub struct LocalUsageTracker { /* private fields */ }
Expand description
Local usage tracker for Anthropic API calls
Implementations§
Source§impl LocalUsageTracker
impl LocalUsageTracker
Sourcepub async fn record_call(
&self,
model: &str,
input_tokens: u32,
output_tokens: u32,
response_time_ms: u64,
success: bool,
request_id: Option<String>,
) -> Result<()>
pub async fn record_call( &self, model: &str, input_tokens: u32, output_tokens: u32, response_time_ms: u64, success: bool, request_id: Option<String>, ) -> Result<()>
Record an API call
Sourcepub async fn get_usage_stats(
&self,
start_time: DateTime<Utc>,
end_time: DateTime<Utc>,
) -> Result<AnthropicUsageStats>
pub async fn get_usage_stats( &self, start_time: DateTime<Utc>, end_time: DateTime<Utc>, ) -> Result<AnthropicUsageStats>
Get usage statistics for a time period
Sourcepub async fn get_rate_limit_info(&self) -> Result<RateLimitInfo>
pub async fn get_rate_limit_info(&self) -> Result<RateLimitInfo>
Get estimated rate limit information
Sourcepub async fn call_count(&self) -> usize
pub async fn call_count(&self) -> usize
Get the number of recorded calls
Trait Implementations§
Source§impl Clone for LocalUsageTracker
impl Clone for LocalUsageTracker
Source§fn clone(&self) -> LocalUsageTracker
fn clone(&self) -> LocalUsageTracker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for LocalUsageTracker
impl Debug for LocalUsageTracker
Auto Trait Implementations§
impl Freeze for LocalUsageTracker
impl !RefUnwindSafe for LocalUsageTracker
impl Send for LocalUsageTracker
impl Sync for LocalUsageTracker
impl Unpin for LocalUsageTracker
impl !UnwindSafe for LocalUsageTracker
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