Skip to main content

Overview

Some use cases require tracking the token usage of the API responses. This can be done by getting InferenceUsage object from Instructor LLM response object. Code below demonstrates how it can be retrieved for both sync and streamed requests.

Example