LLMConsumptionRegistry

Resolves consumption flavors discovered on the classpath via LLMConsumptionType services.

Discovery is lazy (on first use) and uses the thread context classloader, so there is no startup-ordering requirement: whichever provider jars are present contribute their flavors. The library ships LiteLLM; the consuming app contributes its own provider-specific flavors via its own META-INF/services entry.

Functions

Link copied to clipboard
fun decode(displayLabel: String, obj: JsonObject): LLMConsumption

Decodes consumption identified by its top-level "unit" displayLabel.

Link copied to clipboard

Resolves the unit from a top-level "unit" display label (e.g. "LiteLLM tokens").

Link copied to clipboard

Resolves the unit from a formatted-amount short suffix (e.g. "tokens").