ImageUsage
class ImageUsage extends TextUsage
Methods
__construct(int $inputTokens = 0, int $outputTokens = 0, int|null $cacheReadInputTokens = null, int|null $cacheWriteInputTokens = null, int|null $reasoningTokens = null, int|null $imageInputTokens = null, int|null $imageOutputTokens = null)
Create image generation usage data.
array
toArray()
Get the instance as an array.
static TextUsage
fromArray(array $data)
Reconstruct an instance from a previously serialized toArray() payload.
from
TextUsage
int
uncachedInputTokens()
Get the input tokens that were neither read from nor written to a prompt cache.
from
TextUsage
from
TextUsage
Details
at line 15
__construct(int $inputTokens = 0, int $outputTokens = 0, int|null $cacheReadInputTokens = null, int|null $cacheWriteInputTokens = null, int|null $reasoningTokens = null, int|null $imageInputTokens = null, int|null $imageOutputTokens = null)
Create image generation usage data.
in
Usage at line 24
int
totalTokens()
Get the total number of input and output tokens.
at line 30
array
toArray()
Get the instance as an array.
in
Usage at line 43
array
jsonSerialize()
Get the JSON serializable representation of the instance.
in
TextUsage at line 33
static TextUsage
fromArray(array $data)
Reconstruct an instance from a previously serialized toArray() payload.
in
TextUsage at line 47
int
uncachedInputTokens()
Get the input tokens that were neither read from nor written to a prompt cache.
in
TextUsage at line 55
TextUsage
add(TextUsage $usage)
Add the given usage to the current usage and return a new usage instance.
in
TextUsage at line 69
static protected int|null
sum(int|null $a, int|null $b)
Sum two optional counts, preserving null when neither was reported.