CostRecorded

org.llm4s.trace.TraceEvent.CostRecorded
See theCostRecorded companion object
final case class CostRecorded extends TraceEvent

Tracks cost in USD for any model operation.

Value parameters

costType

Category: "embedding", "completion", "total"

costUsd

Estimated cost in US dollars

model

Model name used for pricing lookup

operation

Type of operation: "embedding", "completion", "evaluation"

tokenCount

Total tokens consumed

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait TraceEvent
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def eventType: String
def toJson: Value
def withCostType(costType: String): CostRecorded
def withCostUsd(costUsd: Double): CostRecorded
def withModel(model: String): CostRecorded
def withOperation(operation: String): CostRecorded
def withTimestamp(timestamp: Instant): CostRecorded
def withTokenCount(tokenCount: Int): CostRecorded

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
def span: Option[TraceSpan]

Where this event sits in a trace, when its emitter places it in one (design 4.58): the span it is, that span's parent and when it started; the event's timestamp is its end. None for an event traced on its own. Only TraceEvent.CustomEvent, TraceEvent.TokenUsageRecorded, TraceEvent.ErrorOccurred and TraceEvent.AgentRunEnded carry one.

Where this event sits in a trace, when its emitter places it in one (design 4.58): the span it is, that span's parent and when it started; the event's timestamp is its end. None for an event traced on its own. Only TraceEvent.CustomEvent, TraceEvent.TokenUsageRecorded, TraceEvent.ErrorOccurred and TraceEvent.AgentRunEnded carry one.

Attributes

Inherited from:
TraceEvent