Skip to navigation

Generated from cargo doc --no-deps -p nemo-relay-builtins -p nemo-relay-diagnostics -p nemo-relay-logging -p nemo-relay-plugin-host -p nemo-relay-codecs -p nemo-relay -p nemo-relay-runtime -p nemo-relay-model-pricing -p nemo-relay-resource-metrics -p nemo-relay-observability -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.

pub struct Usage {
    pub prompt_tokens: Option<u64>,
    pub completion_tokens: Option<u64>,
    pub total_tokens: Option<u64>,
    pub cache_read_tokens: Option<u64>,
    pub cache_write_tokens: Option<u64>,
    pub cache_write_1h_tokens: Option<u64>,
    pub uncached_input_tokens: Option<u64>,
    pub cost: Option<CostEstimate>,
    pub cache_write_token_counts: Option<CacheWriteTokenCountsList>,
}

Optional provider token counts and cost; absent counts never imply zero.

Fields

prompt_tokens: Option<u64>

Tokens consumed by the prompt/input.

completion_tokens: Option<u64>

Tokens generated in the completion/output.

total_tokens: Option<u64>

Total tokens (prompt + completion).

cache_read_tokens: Option<u64>

Tokens served from prompt cache (read).

cache_write_tokens: Option<u64>

Legacy aggregate prompt-cache write count; use cache_write_token_counts when present.

cache_write_1h_tokens: Option<u64>

Legacy one-hour subset of the aggregate prompt-cache write count.

uncached_input_tokens: Option<u64>

Input tokens neither read from nor written to the provider’s prompt cache. Include this value only when the provider’s usage rules define this split. Absence does not mean zero.

cost: Option<CostEstimate>

Optional cost reported by provider data or estimated from Relay model pricing.

cache_write_token_counts: Option<CacheWriteTokenCountsList>

Ordered duration-aware cache writes; presence overrides both legacy cache-write fields.

Implementations

impl Usage

impl Usage

prompt_tokens

pub fn prompt_tokens(&self) -> u64

Returns the value of prompt_tokens, or the default value if prompt_tokens is unset.

completion_tokens

pub fn completion_tokens(&self) -> u64

Returns the value of completion_tokens, or the default value if completion_tokens is unset.

total_tokens

pub fn total_tokens(&self) -> u64

Returns the value of total_tokens, or the default value if total_tokens is unset.

cache_read_tokens

pub fn cache_read_tokens(&self) -> u64

Returns the value of cache_read_tokens, or the default value if cache_read_tokens is unset.

cache_write_tokens

pub fn cache_write_tokens(&self) -> u64

Returns the value of cache_write_tokens, or the default value if cache_write_tokens is unset.

cache_write_1h_tokens

pub fn cache_write_1h_tokens(&self) -> u64

Returns the value of cache_write_1h_tokens, or the default value if cache_write_1h_tokens is unset.

uncached_input_tokens

pub fn uncached_input_tokens(&self) -> u64

Returns the value of uncached_input_tokens, or the default value if uncached_input_tokens is unset.

Trait Implementations

impl Clone for Usage

impl Clone for Usage

clone

fn clone(&self) -> Usage

clone_from

fn clone_from(&mut self, source: &Self)

impl Debug for Usage

impl Debug for Usage

fmt

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Default for Usage

impl Default for Usage

default

fn default() -> Self

impl Message for Usage

impl Message for Usage

encoded_len

fn encoded_len(&self) -> usize

clear

fn clear(&mut self)

encode

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
    Self: Sized,

encode_to_vec

fn encode_to_vec(&self) -> Vec<u8> where
    Self: Sized,

encode_length_delimited

fn encode_length_delimited(
    &self,
    buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
    Self: Sized,

encode_length_delimited_to_vec

fn encode_length_delimited_to_vec(&self) -> Vec<u8> where
    Self: Sized,

decode

fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
    Self: Default,

decode_length_delimited

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
    Self: Default,

merge

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
    Self: Sized,

merge_length_delimited

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
    Self: Sized,

impl Name for Usage

impl Name for Usage

NAME

const NAME: &'static str = "Usage"

PACKAGE

const PACKAGE: &'static str = "nvidia.nemo.relay.worker.v1"

full_name

fn full_name() -> String

type_url

fn type_url() -> String

impl PartialEq for Usage

impl PartialEq for Usage

eq

fn eq(&self, other: &Usage) -> bool

ne

fn ne(&self, other: &Rhs) -> bool

impl WireValue<Usage> for Usage

impl WireValue<Usage> for Usage

to_wire

fn to_wire(self) -> Result<Usage>

from_wire

fn from_wire(value: Usage) -> Result<Self>

impl StructuralPartialEq for Usage

impl StructuralPartialEq for Usage