so, here the inputTokens are all input tokens, including cached and uncached, or only uncached tokens?
Is it correct to calculate uncached tokens as inputTokens - inputTokensDetails.cached_tokens
Yes. inputTokens is the total input token count, including both cached and uncached tokens.
The Agents SDK docs describe inputTokens as the number of input tokens used across all requests, and inputTokensDetails as the breakdown for those input tokens.
So this is the right calculation:
uncachedInputTokens = inputTokens - cachedTokens
For the Agents SDK inputTokensDetails is an array. Sum the cached token entries first:
As @vb mentioned, inputTokens represents the total input tokens including both cached and uncached tokens, so calculating uncached tokens as inputTokens - cachedTokens is the correct approach. Really appreciate the clear clarification on this @vb.