How to get the number of tokens used in OpenAI

As shown in the screenshots, my OpenAI Chat Model already includes this information, but it is not returned in the response. How can I retrieve the totalUsage?



Information on your n8n setup

  • n8n version: 1.97.1
  • Database: postgres
  • n8n EXECUTIONS_PROCESS setting: default
  • Running n8n via (Docker, npm, n8n cloud, desktop app):docker
  • Operating system:linux?
1 Like