How to get the token consumed by a `ai.run()` request? For example, the below code. I want to know

How to get the token consumed by a
ai.run()
request?

For example, the below code. I want to know the total token consumed by this request so that we charge to customer accordingly.

const response = await env.AI.run('@cf/meta/llama-2-7b-chat-int8', {
  prompt: "tell me a joke about cloudflare";
});
Was this page helpful?