Skip to content

Expose token usage from openAIResponsesAdapter #1078

Description

@rabisg

Is your feature request related to a problem? Please describe.
openAIResponsesAdapter() currently ignores response.completed, including response.usage.

Describe the solution you'd like
Could the adapter expose an optional callback?

openAIResponsesAdapter({
onUsage: (usage) => {
// input_tokens, output_tokens, total_tokens
},
});
This would let applications display token usage or estimated remaining context without implementing a custom stream adapter.

Describe alternatives you've considered
Local adapter that wraps/forks openAIResponseAdapter

Additional context
This would help implement a context available/used counter in the composer

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions