usage

package
v0.6.65 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	InputTokens     int64
	OutputTokens    int64
	TotalTokens     int64
	CachedTokens    int64
	ReasoningTokens int64
	InputCost       float64
	OutputCost      float64
	TotalCost       float64
}

Record contains a single provider usage event, normalized to the Console schema.

type Usage

type Usage struct {
	// contains filtered or unexported fields
}

Usage is the central run-level token and cost accumulator for agent harnesses.

func New

func New(existing *console.AgentRunUsage) *Usage

func (*Usage) Attributes

func (u *Usage) Attributes() *console.AiUsageAttributes

func (*Usage) RecordCumulativeCost added in v0.6.65

func (u *Usage) RecordCumulativeCost(scope string, cumulative float64) float64

RecordCumulativeCost records the positive change from the previous cost snapshot for scope and returns that change. The first snapshot for a scope is measured from zero. A lower snapshot resets the scope baseline without recording a cost.

func (*Usage) RecordUsage

func (u *Usage) RecordUsage(record Record)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL