Skip to content

Fix subscription sessions showing API cost estimates - #696

Draft
alejandro-ao wants to merge 2 commits into
mainfrom
fix/subscription-cost-estimates
Draft

alejandro-ao wants to merge 2 commits into
mainfrom
fix/subscription-cost-estimates

Conversation

@alejandro-ao

Copy link
Copy Markdown
Collaborator

Summary

  • Mark assistant usage produced through subscription-backed OAuth credentials.
  • Exclude API catalog rates from TUI, RPC model metadata, and HTML usage estimates for subscription requests.
  • Preserve catalog estimates for direct API-key requests, including Anthropic API-key usage.
  • Add regression tests and document the behavior.

User experience

Subscription sessions no longer display misleading API-equivalent dollar costs. Token, cache, timing, and tool usage remain available; API-key sessions retain their estimated costs.

Issue

Addresses the reported issue where subscription-backed sessions showed direct API pricing. No tracked issue number was provided.

Manual validation

  1. Log in to an OAuth/subscription provider such as OpenAI Codex or Anthropic.
  2. Run a prompt with enough usage to populate the session sidebar.
  3. Confirm the session does not show an API-equivalent dollar estimate ($N/A is expected when no provider-reported charge exists).
  4. Repeat with a direct API key and confirm catalog-based estimates still appear.
  5. Optionally export both sessions and verify the Usage tab follows the same behavior.

Verification

  • uv run pytest — 1925 passed, 3 skipped
  • uv run ruff check .
  • uv run ruff format --check .
  • uv run mypy
  • uv build

@alejandro-ao

Copy link
Copy Markdown
Collaborator Author

Implemented the review fix in eb5a75f.

  • Persist both api and subscription pricing modes on new assistant responses.
  • Keep historical API pricing stable after switching the active credential to OAuth.
  • Added regression coverage and updated the development note.

Validation:

  • uv run pytest — 1925 passed, 3 skipped
  • uv run ruff check .
  • uv run ruff format --check .
  • uv run mypy
  • uv build

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