GoogleTokenUsage
Namespace: Vercel.AI.Google
public sealed class GoogleTokenUsageToken usage converted from Gemini usageMetadata.
Inheritance: object
Constructors
Section titled “Constructors”GoogleTokenUsage(int, int, int, int, int, int, JsonElement?)
Section titled “GoogleTokenUsage(int, int, int, int, int, int, JsonElement?)”public GoogleTokenUsage(int inputTotal, int noCache, int cacheRead, int outputTotal, int text, int reasoning, JsonElement? raw)Creates converted usage. CacheWrite stays null because Gemini does not report cache writes.
Parameters
| Name | Type | Description |
|---|---|---|
inputTotal |
int | |
noCache |
int | |
cacheRead |
int | |
outputTotal |
int | |
text |
int | |
reasoning |
int | |
raw |
JsonElement? |
Properties
Section titled “Properties”CacheRead
Section titled “CacheRead”public int CacheRead { get; }Cached content tokens.
Value: int
CacheWrite
Section titled “CacheWrite”public int? CacheWrite { get; }Always null. Gemini does not report cache writes.
Value: int?
InputTotal
Section titled “InputTotal”public int InputTotal { get; }Prompt tokens plus tool-use prompt tokens.
Value: int
NoCache
Section titled “NoCache”public int NoCache { get; }Input tokens that were not served from cache.
Value: int
OutputTotal
Section titled “OutputTotal”public int OutputTotal { get; }Candidate tokens plus thought tokens.
Value: int
public JsonElement? Raw { get; }The original usage object.
Value: JsonElement?
Reasoning
Section titled “Reasoning”public int Reasoning { get; }Thought tokens.
Value: int
public int Text { get; }Candidate tokens.
Value: int
Methods
Section titled “Methods”ToLanguageModelUsage()
Section titled “ToLanguageModelUsage()”public LanguageModelUsage ToLanguageModelUsage()Maps onto the shared usage type. Cache writes stay unset.
Returns: LanguageModelUsage
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product