Back to Firebase Js Sdk

UsageMetadata interface

docs-devsite/ai.usagemetadata.md

12.12.13.9 KB
Original Source

Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference

{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}

UsageMetadata interface

Usage metadata about a GenerateContentResponse<!-- -->.

<b>Signature:</b>

typescript
export interface UsageMetadata 

Properties

PropertyTypeDescription
cachedContentTokenCountnumberThe number of tokens in the prompt that were served from the cache. If implicit caching is not active or no content was cached, this will be 0.
cacheTokensDetailsModalityTokenCount<!-- -->[]Detailed breakdown of the cached tokens by modality (for example, text or image). This list provides granular insight into which parts of the content were cached.
candidatesTokenCountnumber
candidatesTokensDetailsModalityTokenCount<!-- -->[]
promptTokenCountnumber
promptTokensDetailsModalityTokenCount<!-- -->[]
thoughtsTokenCountnumberThe number of tokens used by the model's internal "thinking" process.
toolUsePromptTokenCountnumberThe number of tokens used by tools.
toolUsePromptTokensDetailsModalityTokenCount<!-- -->[]A list of tokens used by tools, broken down by modality.
totalTokenCountnumber

UsageMetadata.cachedContentTokenCount

The number of tokens in the prompt that were served from the cache. If implicit caching is not active or no content was cached, this will be 0.

<b>Signature:</b>

typescript
cachedContentTokenCount?: number;

UsageMetadata.cacheTokensDetails

Detailed breakdown of the cached tokens by modality (for example, text or image). This list provides granular insight into which parts of the content were cached.

<b>Signature:</b>

typescript
cacheTokensDetails?: ModalityTokenCount[];

UsageMetadata.candidatesTokenCount

<b>Signature:</b>

typescript
candidatesTokenCount: number;

UsageMetadata.candidatesTokensDetails

<b>Signature:</b>

typescript
candidatesTokensDetails?: ModalityTokenCount[];

UsageMetadata.promptTokenCount

<b>Signature:</b>

typescript
promptTokenCount: number;

UsageMetadata.promptTokensDetails

<b>Signature:</b>

typescript
promptTokensDetails?: ModalityTokenCount[];

UsageMetadata.thoughtsTokenCount

The number of tokens used by the model's internal "thinking" process.

<b>Signature:</b>

typescript
thoughtsTokenCount?: number;

UsageMetadata.toolUsePromptTokenCount

The number of tokens used by tools.

<b>Signature:</b>

typescript
toolUsePromptTokenCount?: number;

UsageMetadata.toolUsePromptTokensDetails

A list of tokens used by tools, broken down by modality.

<b>Signature:</b>

typescript
toolUsePromptTokensDetails?: ModalityTokenCount[];

UsageMetadata.totalTokenCount

<b>Signature:</b>

typescript
totalTokenCount: number;