cost

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package cost is the Stage-1 namespace for cost-tracking types and functions in package engine. See ../REFACTOR_PLAN.md.

New code in hawk should import this package instead of reaching into engine for cost symbols. Implementation will move here in Stage 2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDisplay

func FormatDisplay(totalUSD float64) string

FormatDisplay renders a USD value for terminal display.

func LoadHistory

func LoadHistory() ([]analytics.CostEntry, error)

LoadHistory reads persisted cost entries from analytics storage.

func ModelPricing

func ModelPricing(modelName string) (inputPricePerM, outputPricePerM float64)

ModelPricing returns input + output USD-per-million-token prices for a model.

Types

type Cost

type Cost = engine.Cost

Cost is the canonical cost record (input/output tokens + USD).

type ModelPrice

type ModelPrice = engine.ModelPrice

ModelPrice is a per-million-token price tuple for a single model.

type Optimizer

type Optimizer = engine.CostOptimizer

Optimizer recommends cheaper models / shorter prompts when costs trend up.

func NewOptimizer

func NewOptimizer() *Optimizer

NewOptimizer returns a fresh cost optimizer.

type Recommendation

type Recommendation = engine.Recommendation

Recommendation is an Optimizer's suggested change.

type RequestCost

type RequestCost = engine.RequestCost

RequestCost is the cost of a single LLM request.

type Tracker

type Tracker = engine.CostTracker

Tracker accumulates per-session cost and persists it to analytics.

func NewTracker

func NewTracker(sessionID string) *Tracker

NewTracker returns a tracker scoped to the given session.

Jump to

Keyboard shortcuts

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