Module Result.Usage

Usage statistics for API calls.

type t

Type for usage statistics.

val jsont : t Jsont.t

jsont is the Jsont codec for usage statistics.

val create : ?input_tokens:int -> ?output_tokens:int -> ?total_tokens:int -> ?cache_creation_input_tokens:int -> ?cache_read_input_tokens:int -> unit -> t

create ?input_tokens ?output_tokens ?total_tokens ?cache_creation_input_tokens ?cache_read_input_tokens () creates usage statistics.

val input_tokens : t -> int option

input_tokens t returns the number of input tokens used.

val output_tokens : t -> int option

output_tokens t returns the number of output tokens generated.

val total_tokens : t -> int option

total_tokens t returns the total number of tokens.

val cache_creation_input_tokens : t -> int option

cache_creation_input_tokens t returns cache creation input tokens.

val cache_read_input_tokens : t -> int option

cache_read_input_tokens t returns cache read input tokens.

val unknown : t -> Unknown.t

unknown t returns the unknown fields preserved from JSON.