class LLMTokenUsage extends AbstractObject implements IdAble, Node

A count of tokens consumed by LLM API calls.

Properties

$lastQuery from  AbstractObject

Methods

__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

null|array|string|int|float|bool
queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

int
cachedTokenReads()

Input tokens served from the provider's prompt cache.

int
cachedTokenWrites()

Input tokens written to the provider's prompt cache.

Id
id()

A unique identifier for this LLMTokenUsage.

int
inputTokens()

Uncached input tokens sent to the model.

int
outputTokens()

Tokens received from the model, including text and tool calls.

int
totalTokens()

Total tokens consumed, as reported by the provider.

Details

in AbstractObject at line 13
__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

Parameters

AbstractClient $client
QueryBuilderChain $queryBuilderChain

in AbstractObject at line 19
protected null|array|string|int|float|bool queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

Parameters

QueryBuilder $leafQueryBuilder
string $leafKey

Return Value

null|array|string|int|float|bool

at line 19
int cachedTokenReads()

Input tokens served from the provider's prompt cache.

Return Value

int

at line 28
int cachedTokenWrites()

Input tokens written to the provider's prompt cache.

Return Value

int

at line 37
Id id()

A unique identifier for this LLMTokenUsage.

Return Value

Id

at line 46
int inputTokens()

Uncached input tokens sent to the model.

Return Value

int

at line 55
int outputTokens()

Tokens received from the model, including text and tool calls.

Return Value

int

at line 64
int totalTokens()

Total tokens consumed, as reported by the provider.

Return Value

int