Skip to content

Conversation

@chaitanyarahalkar
Copy link
Contributor

@chaitanyarahalkar chaitanyarahalkar commented Jun 16, 2025

What’s new

This PR adds optional, provider-aware cost estimates to the Goose CLI and addresses issue/feature request #2933
CLI tools like Claude Code have also started adding cost estimates to ensure that spending is tracked for the session.

Key points

  1. Cost display (disabled by default)

    • New config flag GOOSE_CLI_SHOW_COST (or env-var) shows the dollar cost after each exchange.
    • No change to existing UX unless the user opts-in.
  2. **Accurate per-provider tables based on current data for OpenAI, Anthropic and Google AI

  3. CLI integration

    • When enabled, after the context-usage line the CLI prints
      Cost: $0.0123 USD (123 tokens: in 63, out 60)
      
    • Cost figures are estimated from the provider’s usage data. When using open weight models, the cost figures are not shown
  4. Configurable & future-proof

    • Adding/changing rates only requires editing the table in session/output.rs.
    • Unknown models/providers simply omit the cost line.

Screenshot

Screenshot 2025-06-15 at 11 13 07 PM

How to enable

# one-off
GOOSE_CLI_SHOW_COST=true goose chat

# persistent
# ~/.config/goose/config.yaml
GOOSE_CLI_SHOW_COST: true

@zanesq zanesq requested review from baxen and michaelneale June 18, 2025 20:16
@michaelneale
Copy link
Collaborator

nice, LGTM

@michaelneale
Copy link
Collaborator

(will need to update, run cargo fmt and clippy etc)

@sambradbury
Copy link
Contributor

This is similar to the changes here which add cost tracking the UI #2992

That MR doesn't handle the CLI as yours does but querying for updated pricing would be better than having to hardcode pricing here.

@patrickReiis
Copy link
Contributor

Thank you very much 🙏🙏🙏🙏🙏

Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

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

So yeah, since the other CL is merged and has actual price information rather than estimating it, I would suggest we use that infrastructure rather than adding our own estimates here

@DOsinga DOsinga self-assigned this Jul 16, 2025
@DOsinga
Copy link
Collaborator

DOsinga commented Jul 28, 2025

closing this for now - let me know if you want to pick it up again

@DOsinga DOsinga closed this Jul 28, 2025
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.

5 participants