Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(app-server): expose account token usage [1 of 2]#25344

Merged
fcoury-oai merged 3 commits into
mainfrom
fcoury/tokenmaxxing-api
Jun 5, 2026
Merged

feat(app-server): expose account token usage [1 of 2]#25344
fcoury-oai merged 3 commits into
mainfrom
fcoury/tokenmaxxing-api

Conversation

@fcoury-oai

@fcoury-oai fcoury-oai commented May 30, 2026

Copy link
Copy Markdown
Contributor

Why

Token activity is useful account-level context, but terminal clients need a supported app-server path to fetch it without reaching into ChatGPT backend details directly. The API should also live under the broader account usage umbrella so future usage surfaces can be added without proliferating user-facing concepts.

What Changed

  • Add codex-backend-client support for the ChatGPT profile token-usage payload.
  • Add the v2 account/usage/read app-server RPC.
  • Map lifetime usage, peak daily usage, streak, longest task duration, and daily buckets into app-server protocol types.
  • Gate the request on Codex-backend auth, which supports ChatGPT auth tokens and AgentIdentity.
  • Regenerate the app-server JSON and TypeScript schema fixtures.

Token Count Source

account/usage/read returns the token-usage aggregate supplied by the ChatGPT profile backend. App-server maps that backend-owned aggregate into protocol fields; it does not recompute cached-token treatment, usage multipliers, or raw input/output totals locally.

Stack

  1. feat(app-server): expose account token usage [1 of 2] (this PR)
  2. #25345 feat(tui): add token activity command [2 of 2]

How to Test

  1. Start an app-server client from this branch while authenticated with ChatGPT or AgentIdentity.
  2. Call account/usage/read.
  3. Confirm the response includes summary and dailyUsageBuckets.
  4. Also verify a session without Codex-backend auth receives the existing auth error path.

Targeted tests:

  • just test -p codex-backend-client -p codex-app-server-protocol -p codex-app-server
  • just write-app-server-schema

@fcoury-oai fcoury-oai changed the title feat(app-server): expose account token usage feat(app-server): expose account token usage [1 of 3] May 30, 2026
@fcoury-oai fcoury-oai changed the title feat(app-server): expose account token usage [1 of 3] feat(app-server): expose account token usage [1 of 2] May 31, 2026
@fcoury-oai fcoury-oai force-pushed the fcoury/tokenmaxxing-api branch from da5112c to 618777b Compare June 3, 2026 18:48

@etraut-openai etraut-openai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one comment about token refresh that you might want to consider. Otherwise looks good.

Comment thread codex-rs/app-server/src/request_processors/account_processor.rs
@fcoury-oai fcoury-oai force-pushed the fcoury/tokenmaxxing-api branch from 411410b to c375867 Compare June 5, 2026 14:18
@fcoury-oai fcoury-oai enabled auto-merge (squash) June 5, 2026 14:25
@fcoury-oai fcoury-oai merged commit 5e62c73 into main Jun 5, 2026
31 checks passed
@fcoury-oai fcoury-oai deleted the fcoury/tokenmaxxing-api branch June 5, 2026 14:43
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants