One Logo Pool Ball
FoundationModels · IOS API REFERENCE

LanguageModelExecutorGenerationChannel.Usage

struct · iOS 27.0+ · SDK 27.1

struct Usage

Snapshot of an entry's token totals. Producers report the current cumulative totals on every update and consumers replace prior totals wholesale.

Members (7)

init · iOS 27.0+

init

TypeScript
static init(input: LanguageModelExecutorGenerationChannel_Usage_Input, output: LanguageModelExecutorGenerationChannel_Usage_Output, metadata?: Record<string, SDKHandle>): LanguageModelExecutorGenerationChannel_Usage
Swift declaration
init(input: LanguageModelExecutorGenerationChannel.Usage.Input, output: LanguageModelExecutorGenerationChannel.Usage.Output, metadata: [String : any ConvertibleToGeneratedContent] = [:])

Creates a usage update. - Parameters: - input: Token counts for the transcript. - output: Token counts for the response. - metadata: Additional metadata to record alongside the token counts.

get · iOS 27.0+

input

TypeScript
get input(): LanguageModelExecutorGenerationChannel_Usage_Input
Swift declaration
var input: LanguageModelExecutorGenerationChannel.Usage.Input

The input token counts from the transcript.

set · iOS 27.0+

input

TypeScript
set input(value: LanguageModelExecutorGenerationChannel_Usage_Input)
Swift declaration
var input: LanguageModelExecutorGenerationChannel.Usage.Input

The input token counts from the transcript.

get · iOS 27.0+

output

TypeScript
get output(): LanguageModelExecutorGenerationChannel_Usage_Output
Swift declaration
var output: LanguageModelExecutorGenerationChannel.Usage.Output

The output token counts from the response.

set · iOS 27.0+

output

TypeScript
set output(value: LanguageModelExecutorGenerationChannel_Usage_Output)
Swift declaration
var output: LanguageModelExecutorGenerationChannel.Usage.Output

The output token counts from the response.

get · iOS 27.0+

metadata

TypeScript
get metadata(): Record<string, GeneratedContent>
Swift declaration
var metadata: [String : GeneratedContent]

The additional metadata with a token count.

set · iOS 27.0+

metadata

TypeScript
set metadata(value: Record<string, GeneratedContent>)
Swift declaration
var metadata: [String : GeneratedContent]

The additional metadata with a token count.

Skipped declarations

No declarations were skipped in this snapshot.

All FoundationModels types →