pub struct PerProviderUsage {
pub claude: UsageResult,
pub codex: UsageResult,
pub copilot: UsageResult,
pub gemini: UsageResult,
pub opencode: UsageResult,
pub cursor: UsageResult,
pub hermes: UsageResult,
pub grok: UsageResult,
}Expand description
Per-provider usage data, keyed by source directory rather than by model name.
The top-level UsageResult in UsageData intentionally merges same-named
models across providers (so the per-model table shows one row for
claude-sonnet-4-6 regardless of whether Claude Code, Copilot CLI, or
both invoked it). That merge loses the source information though, which
matters for the per-provider summary: once Copilot CLI stopped writing
the copilot sentinel and started recording real model names, the old
“classify each row by model-name prefix” logic mis-attributed every
Copilot session to Claude Code.
This struct keeps a separate UsageResult per provider so the display
layer can sum tokens and cost by source directory directly, with no
prefix heuristics involved. It is populated in usage::aggregator at
the same time the global merged map is built.
Fields§
§claude: UsageResultPer-model usage attributed to Claude Code.
codex: UsageResultPer-model usage attributed to Codex.
copilot: UsageResultPer-model usage attributed to Copilot CLI.
gemini: UsageResultPer-model usage attributed to Gemini CLI.
opencode: UsageResultPer-model usage attributed to OpenCode.
cursor: UsageResultPer-model usage attributed to Cursor.
hermes: UsageResultPer-model usage attributed to Hermes.
grok: UsageResultPer-model usage attributed to Grok CLI.
Implementations§
Source§impl PerProviderUsage
impl PerProviderUsage
Sourcepub fn get(&self, provider: Provider) -> Option<&UsageResult>
pub fn get(&self, provider: Provider) -> Option<&UsageResult>
Returns the usage map for provider, or None for Provider::Unknown.
Sourcepub fn get_mut(&mut self, provider: Provider) -> Option<&mut UsageResult>
pub fn get_mut(&mut self, provider: Provider) -> Option<&mut UsageResult>
Returns a mutable handle to the usage map for provider, or None for
Provider::Unknown.
Trait Implementations§
Source§impl Clone for PerProviderUsage
impl Clone for PerProviderUsage
Source§fn clone(&self) -> PerProviderUsage
fn clone(&self) -> PerProviderUsage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PerProviderUsage
impl Debug for PerProviderUsage
Source§impl Default for PerProviderUsage
impl Default for PerProviderUsage
Source§fn default() -> PerProviderUsage
fn default() -> PerProviderUsage
Auto Trait Implementations§
impl Freeze for PerProviderUsage
impl RefUnwindSafe for PerProviderUsage
impl Send for PerProviderUsage
impl Sync for PerProviderUsage
impl Unpin for PerProviderUsage
impl UnsafeUnpin for PerProviderUsage
impl UnwindSafe for PerProviderUsage
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
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>
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>
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