TranscriptionUsage
class TranscriptionUsage extends TextUsage
Methods
Create transcription usage data.
Get the instance as an array.
Reconstruct an instance from a previously serialized toArray() payload.
Get the input tokens that were neither read from nor written to a prompt cache.
Sum two optional counts, preserving null when neither was reported.
Details
at line 14
__construct(int $inputTokens = 0, int $outputTokens = 0, int|null $cacheReadInputTokens = null, int|null $cacheWriteInputTokens = null, int|null $reasoningTokens = null, float|null $audioSeconds = null)
Create transcription usage data.
in
Usage at line 24
int
totalTokens()
Get the total number of input and output tokens.
at line 43
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.
at line 28
static TranscriptionUsage
from(TextUsage $usage, float|null $audioSeconds = null)
Create a transcription usage instance from the given usage.