AnthropicUsage
Namespace: Vercel.AI.Anthropic
public static class AnthropicUsageConverts an Anthropic usage object into SDK token counts.
Inheritance: object
Methods
Section titled “Methods”Convert(JsonElement, JsonElement?)
Section titled “Convert(JsonElement, JsonElement?)”public static LanguageModelUsage Convert(JsonElement usage, JsonElement? rawUsage = null)Maps Anthropic usage. Cache creation and cache reads are added to the input total.
Compaction and message iterations are summed when present. Advisor iterations are left out
because they bill at a different rate. A fallback_message iteration keeps the top-level totals.
Parameters
| Name | Type | Description |
|---|---|---|
usage |
JsonElement | |
rawUsage |
JsonElement? |
Returns: LanguageModelUsage
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product