Adds session cost to goose.log #474
Merged
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.
Adds cost to session.log. We can update the format later just getting the data piped through.
{"session_file":"~/.config/goose/sessions/yoyqaq3e.jsonl","usage":[{"model":"claude-3-5-sonnet-20241022-v2:0","usage":{"input_tokens":2067,"output_tokens":204,"total_tokens":2271},"cost":"0.009261"}]} {"session_file":"~/.config/goose/sessions/hao4empo.jsonl","usage":[{"model":"gpt-4o-2024-08-06","usage":{"input_tokens":2749,"output_tokens":41,"total_tokens":2790},"cost":"0.0072825"}]}Changes
Adds costs for models.
Instead of providers collecting usage and the agent asking for it, the provider returns usage (as it already did) to the agent along with the cost on each 'complete' call. The agent collects all usages (which now includes cost). This keeps providers with less state and also makes it trivial for the agent to collect usage from different providers/models if we ever head back down that path.