merge method

ModelUsage merge(
  1. ModelUsage other
)

Merge another ModelUsage into this one (additive).

Implementation

ModelUsage merge(ModelUsage other) {
  return ModelUsage(
    inputTokens: inputTokens + other.inputTokens,
    outputTokens: outputTokens + other.outputTokens,
    cacheReadInputTokens: cacheReadInputTokens + other.cacheReadInputTokens,
    cacheCreationInputTokens:
        cacheCreationInputTokens + other.cacheCreationInputTokens,
    webSearchRequests: webSearchRequests + other.webSearchRequests,
    costUSD: costUSD + other.costUSD,
    contextWindow: max(contextWindow, other.contextWindow),
    maxOutputTokens: max(maxOutputTokens, other.maxOutputTokens),
  );
}