Package-level declarations

Types

Link copied to clipboard

Registers LiteLLM token consumption with LLMConsumptionRegistry via ServiceLoader.

Link copied to clipboard
@Serializable
data class LiteLLMTokenConsumption(val inputTokens: Long = 0, val outputTokens: Long = 0, val totalTokens: Long = 0) : LLMConsumption

Token-based consumption for the LiteLLM provider.

Link copied to clipboard

Token-based consumption unit (LiteLLM).

Link copied to clipboard
@Serializable(with = LLMConsumptionSerializer::class)
abstract class LLMConsumption

Base type for an amount of LLM consumption recorded during an optimization run.

Link copied to clipboard

Resolves consumption flavors discovered on the classpath via LLMConsumptionType services.

Link copied to clipboard

JSON serializer for any LLMConsumption flavor. The on-disk shape is a single object with a top-level "unit" field (the flavor's LLMConsumptionUnit.displayLabel) plus the flavor's own pretty fields. On read, the "unit" label is resolved through LLMConsumptionRegistry to the right decoder — so no provider-specific dispatch lives here.

Link copied to clipboard

SPI for contributing an LLMConsumption flavor to LLMConsumptionRegistry.

Link copied to clipboard

The unit a particular LLMConsumption flavor is measured in (e.g. tokens, credits).

Functions

Link copied to clipboard

Format an amount as "N,NNN.NN <shortLabel>" (e.g. "12,345.67 tokens"), or "n/a" for null.

Link copied to clipboard

Parse a formatted amount like "12,345.67 tokens" into its value and resolved unit. The unit suffix is resolved through LLMConsumptionRegistry, so any registered flavor parses.

Link copied to clipboard
Link copied to clipboard

Format a finite, non-null amount as "N,NNN.NN <unit>", or "n/a" for null, non-finite, or null-unit inputs. Null unit reads as "n/a" because there's no sensible label to attach.