llm.Usage
The content in this help topic pertains to SuiteScript 2.1.
Object Description |
The token usage for a request to the LLM. This object is included in the llm.Response object returned from llm.generateText(options) (using the Response.usage property) and represents the number of tokens used during a request to the LLM. It includes properties for the number of tokens in the response from the LLM (Usage.completionTokens), the number of tokens in the request to the LLM (Usage.promptTokens), and the total number of tokens for the entire request (Usage.totalTokens). This object is available only for Cohere models. |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Methods and Properties |
|
Since |
2025.1 |
Syntax
The following code sample shows the syntax for this member. It isn't a functional example. For a complete script example, see N/llm Module Script Samples.
// Add additional code
...
const response = llm.generateText({
prompt: "Write a 200 word pitch for a TV show about elephants."
});
const usage = response.usage;
...
// Add additional code