pub fn get_usage() -> Result<UsageData, Error>Expand description
Fetch current Claude API usage data.
This is the main entry point for the crate. It:
- Retrieves credentials from platform-specific storage
- Calls the Anthropic usage API
- Returns typed usage data
§Example
ⓘ
use claude_usage::get_usage;
let usage = get_usage()?;
println!("5h utilization: {}%", usage.five_hour.utilization);
println!("7d utilization: {}%", usage.seven_day.utilization);§Errors
Returns Error if:
- Credentials are not found or expired
- API call fails
- Response parsing fails