feat(cli): scope ccam cost to a session and surface tool surcharges#239
Merged
Conversation
`ccam cost` only ever called the whole-database aggregate endpoint and rendered the token-cost total plus the per-model chart. Two things the API already returns were invisible from the terminal: - Per-session cost. The route GET /api/pricing/cost/:sessionId exists and is what the dashboard uses, but the CLI had no way to reach it. `ccam cost --session <id>` now prices a single session (same response shape, so the breakdown/unpriced-warning rendering is shared) — quicker than the full `ccam session <id>` detail view when cost is all you want, and scriptable. - Server-tool surcharges. feature_costs carries the web-search ($10/1k) and code-execution (container-time beyond the org free allowance) charges that are billed on top of tokens. `ccam cost` now prints a "Server-tool surcharges" line whenever either is non-zero, so the total's composition is explainable instead of looking like pure token cost. The line is omitted when nothing is surcharged, keeping the common case uncluttered. Docs synced across the surface: docs/CLI.md, README + VN/CN/KO CLI blocks, and the wiki Insights row (with zh/vi/ko i18n entries and the required cache bump to wiki-v42 / i18n-content.js?v=33). Tests: `ccam cost --session` scoping and the web-search surcharge line added to the CLI suite. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A single, self-contained enhancement to the
ccam costcommand. It was calling only the whole-database aggregate endpoint and rendering the token total + per-model chart, leaving two things the API already returns invisible from the terminal:ccam cost --session <id>now hitsGET /api/pricing/cost/:sessionId(the same route the dashboard uses, previously unreachable from the CLI). Same response shape, so the per-model breakdown and unpriced-model warning render exactly as they do for the aggregate. Faster than the fullccam session <id>view when cost is all you want, and scriptable.feature_costscarries the web-search ($10/1k) and code-execution (container-time beyond the org free allowance) charges billed on top of tokens.ccam costnow prints a Server-tool surcharges line whenever either is non-zero, so the total's composition is explainable instead of reading as pure token cost. The line is omitted when nothing is surcharged, keeping the common case clean.Testing
npm run test:server/npm run test:client— full suite green via the pre-commit hook (new CLI tests:cost --sessionscoping, web-search surcharge line)bash .claude/skills/file-headers/scripts/check-headers.sh— exit 0Docs
Synced across the surface:
docs/CLI.md, README + VN/CN/KO CLI blocks, and the wiki Insights row with zh/vi/ko i18n entries and the required cache bump (wiki-v42/i18n-content.js?v=33).🤖 Generated with Claude Code