Skip to content

🤖 fix: track estimated costs for ChatGPT OAuth usage - #3914

Open
coadler wants to merge 1 commit into
mainfrom
cost-tracking-bhq0
Open

🤖 fix: track estimated costs for ChatGPT OAuth usage#3914
coadler wants to merge 1 commit into
mainfrom
cost-tracking-bhq0

Conversation

@coadler

@coadler coadler commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Track estimated model costs for new ChatGPT OAuth usage.

Background

ChatGPT OAuth usage records token counts but previously displayed zero cost.

The original behavior came from commit 9e60eb2cb and PR #2171.

That path marked OAuth usage as costsIncluded.

Implementation

  • Remove OAuth-specific cost suppression for new requests.
  • Keep generic costsIncluded behavior for other provider routes.
  • Track estimated costs for main streams, advisor calls, status generation, and memory work.
  • Keep existing persisted usage unchanged.

This PR does not migrate old chat rows, session ledgers, or analytics rows.

The displayed amount represents an estimated model-equivalent cost.

It does not represent a ChatGPT subscription invoice.

Validation

  • make static-check
  • Focused tests: 276 passed, 0 failed.

Risks

  • Existing OAuth usage remains at $0.00.
  • New OAuth usage uses the current model pricing table.
  • Generic provider routes with costsIncluded remain unchanged.

Generated with mux • Model: openai:gpt-5.6-luna • Thinking: xhigh • Cost: $0.04

@coadler

coadler commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the ChatGPT OAuth cost tracking fix.

@chatgpt-codex-connector

This comment has been minimized.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b221518e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/services/sessionUsageService.ts Outdated
Comment thread src/node/services/sessionUsageService.ts Outdated
Comment thread src/node/services/sessionUsageService.ts Outdated
Comment thread src/node/services/sessionUsageService.ts Outdated
@coadler

coadler commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

The security review reported no findings. I minimized that informational comment.
Please run the code review gate again.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b221518e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/services/sessionUsageService.ts Outdated
Comment thread src/node/services/sessionUsageService.ts Outdated
@chatgpt-codex-connector

This comment has been minimized.

@coadler
coadler force-pushed the cost-tracking-bhq0 branch from 8b22151 to d855b12 Compare August 21, 2026 17:52
@coadler

coadler commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

The PR now uses a forward-only scope.

It tracks estimated costs for new ChatGPT OAuth requests.

It does not migrate old ledgers or analytics rows.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: d855b12c98

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

This comment has been minimized.

@coadler
coadler added this pull request to the merge queue Aug 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant