How to Track Token Usage Directly from AI Agent in n8n

I’m currently using the AI Agent in n8n, with the model configured via the Azure OpenAI node under the model section.

While I can see the token usage details from the Azure OpenAI node’s output, I’m looking for a way to track token usage directly from the AI Agent itself — without having to use an HTTP node or check the API provider’s dashboard.

Is there any built-in way to access this information directly from the agent?

Also, if there’s any recommended approach to store the token usage (from either the AI Agent or model node) into a Google Sheet or database, that would be extremely helpful as well.

Structure of AI Agent:

Output of Model Node:

Output of AI Agent Node:

2 Likes

Hello @Prithvi_iamneo, welcome to the n8n :n8n: community!

Actually, this feature still isn’t directly available up to now..
If you search in the forum, you’ll find that there have already been some discussions and a few workarounds:

But for now, I recommend this ready-made workflow from my friend Solomon:

And finally, don’t forget to vote for this feature request here

2 Likes

Thanks for sharing @mohamed3nan :flexed_biceps:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.