# How to calculate only uncached tokens

**URL:** https://community.openai.com/t/how-to-calculate-only-uncached-tokens/1380908
**Category:** API
**Tags:** agents-sdk
**Created:** [May 14, 2026, 8:43am UTC](https://community.openai.com/t/how-to-calculate-only-uncached-tokens/1380908 "2026-05-14T08:43:36Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![mbabayev](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/mbabayev/32/147210_2.png) [@mbabayev](https://community.openai.com/u/mbabayev)
#### Post date: [May 14, 2026, 8:43am UTC](https://community.openai.com/t/how-to-calculate-only-uncached-tokens/1380908/1 "2026-05-14T08:43:36Z")

</div>

An openai Agents SDK returns total agent’s loop tokens usage object as:

```auto
inputTokens,
inputTokensDetails: [{cached_tokens}],
outputTokens

```

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`

---

_[View the full topic](https://community.openai.com/t/how-to-calculate-only-uncached-tokens/1380908)._
