Expose token usage from openAIResponsesAdapter

Open
#1,078 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@justonemorenight is already working on this.

Since Sep 10, 2026.

  • #1147 by @justonemorenight — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
api

Research direction

Start by locating openAIResponsesAdapter and reading how it handles streamed response events. Check how response.completed exposes response.usage, then compare the adapter with the referenced openAIResponseAdapter. Done means an optional onUsage callback receives input_tokens, output_tokens, and total_tokens; an open pull request is already linked to this issue.

Written by the indexing model from the issue text.

Description

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

Dominant language
TypeScript
Stars
10k
Forks
698
Avg merge
1d 3h
Merged PRs (30d)
133

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from thesysdev/openui

All issues in thesysdev/openui

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.